Now using jwt stuff...

This commit is contained in:
Nicolai Ort 2021-08-18 17:12:25 +02:00
parent fe43a2212a
commit f4ec2fe472
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
1 changed files with 6 additions and 9 deletions

View File

@ -1,13 +1,10 @@
import axios from 'axios';
const config = {
username: 'niggl',
password: '9VEBc596T7tiPB7mNJukfeH9LfGzrrJN'
};
import UserStore from './UserStore';
export default class Apiclient {
static async getStats() {
return (
await axios.get('https://kauft.es/api/stats', {
auth: config
headers: { Authorization: `Bearer ${UserStore.state.token}` }
})
).data;
}
@ -15,7 +12,7 @@ export default class Apiclient {
static async getUrls() {
return (
await axios.get('https://kauft.es/api?showVisits=true', {
auth: config
headers: { Authorization: `Bearer ${UserStore.state.token}` }
})
).data;
}
@ -23,7 +20,7 @@ export default class Apiclient {
static async getUrlDetails(shortcode) {
return (
await axios.get(`https://kauft.es/api/${shortcode}`, {
auth: config
headers: { Authorization: `Bearer ${UserStore.state.token}` }
})
).data;
}
@ -31,7 +28,7 @@ export default class Apiclient {
static async getUrlVisits(shortcode) {
return (
await axios.get(`https://kauft.es/api/${shortcode}/visits`, {
auth: config
headers: { Authorization: `Bearer ${UserStore.state.token}` }
})
).data;
}
@ -39,7 +36,7 @@ export default class Apiclient {
static async deleteUrl(shortcode) {
return (
await axios.delete(`https://kauft.es/api/${shortcode}`, {
auth: config
headers: { Authorization: `Bearer ${UserStore.state.token}` }
})
).status;
}