Added adding url functionality to apiclient
This commit is contained in:
parent
c5c8514bab
commit
0c629e2416
|
@ -1,3 +1,4 @@
|
|||
import { data } from 'autoprefixer';
|
||||
import axios from 'axios';
|
||||
import UserStore from './UserStore';
|
||||
|
||||
|
@ -74,6 +75,27 @@ export default class Apiclient {
|
|||
).data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new shorturl via the api
|
||||
* @param {*} target The target (rediction) url for the new shorturl.
|
||||
* @param {*} shortcode A custom shortcode (if needed)
|
||||
* @returns The response data/error
|
||||
*/
|
||||
static async createUrl(target, shortcode) {
|
||||
const res = (
|
||||
await axios.post(`https://kauft.es/api`, {
|
||||
target,
|
||||
shortcode
|
||||
}, {
|
||||
validateStatus: null
|
||||
})
|
||||
);
|
||||
return {
|
||||
status: res.status,
|
||||
data: res.data
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API-Delet for the linkylinky api url deletion endpoint (needs auth)
|
||||
* @param {*} shortcode The shortcode of your most hated url
|
||||
|
|
Loading…
Reference in New Issue