57 lines
1.0 KiB
JavaScript
57 lines
1.0 KiB
JavaScript
import axios from 'axios';
|
|
const config = {
|
|
username: 'niggl',
|
|
password: '9VEBc596T7tiPB7mNJukfeH9LfGzrrJN'
|
|
};
|
|
export default class Apiclient {
|
|
static async getStats() {
|
|
return (
|
|
await axios.get('https://kauft.es/api/stats', {
|
|
auth: config
|
|
})
|
|
).data;
|
|
}
|
|
|
|
static async getUrls() {
|
|
return (
|
|
await axios.get('https://kauft.es/api?showVisits=true', {
|
|
auth: config
|
|
})
|
|
).data;
|
|
}
|
|
|
|
static async getUrlDetails(shortcode) {
|
|
return (
|
|
await axios.get(`https://kauft.es/api/${shortcode}`, {
|
|
auth: config
|
|
})
|
|
).data;
|
|
}
|
|
|
|
static async getUrlVisits(shortcode) {
|
|
return (
|
|
await axios.get(`https://kauft.es/api/${shortcode}/visits`, {
|
|
auth: config
|
|
})
|
|
).data;
|
|
}
|
|
|
|
static async deleteUrl(shortcode) {
|
|
return (
|
|
await axios.delete(`https://kauft.es/api/${shortcode}`, {
|
|
auth: config
|
|
})
|
|
).status;
|
|
}
|
|
|
|
static async login(username, password) {
|
|
return (
|
|
await axios.post(`https://kauft.es/api/auth/login`, {}, {
|
|
auth: {
|
|
username, password
|
|
}
|
|
})
|
|
).data;
|
|
}
|
|
}
|