Removed auth from stats
This commit is contained in:
parent
f4ec2fe472
commit
1cc0c2ce76
|
@ -1,11 +1,19 @@
|
|||
import axios from 'axios';
|
||||
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 {
|
||||
static async getStats() {
|
||||
return (
|
||||
await axios.get('https://kauft.es/api/stats', {
|
||||
headers: { Authorization: `Bearer ${UserStore.state.token}` }
|
||||
})
|
||||
await axios.get('https://kauft.es/api/stats')
|
||||
).data;
|
||||
}
|
||||
|
||||
|
@ -50,4 +58,12 @@ export default class Apiclient {
|
|||
})
|
||||
).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