diff --git a/src/lib/Apiclient.js b/src/lib/Apiclient.js index e2493f8..f5c6827 100644 --- a/src/lib/Apiclient.js +++ b/src/lib/Apiclient.js @@ -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; }