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