Removed auth from stats
This commit is contained in:
parent
f4ec2fe472
commit
1cc0c2ce76
|
@ -1,11 +1,19 @@
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import UserStore from './UserStore';
|
import UserStore from './UserStore';
|
||||||
|
|
||||||
|
axios.interceptors.response.use(response => {
|
||||||
|
return response;
|
||||||
|
}, error => {
|
||||||
|
if (error.response.status === 401) {
|
||||||
|
UserStore.logout();
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
});
|
||||||
|
|
||||||
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')
|
||||||
headers: { Authorization: `Bearer ${UserStore.state.token}` }
|
|
||||||
})
|
|
||||||
).data;
|
).data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,4 +58,12 @@ export default class Apiclient {
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async logout() {
|
||||||
|
return (
|
||||||
|
await axios.post(`https://kauft.es/api/auth/logout`, {}, {
|
||||||
|
headers: { Authorization: `Bearer ${UserStore.state.token}` }
|
||||||
|
})
|
||||||
|
).data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue