mirror of
https://github.com/mgerb/classic-wow-forums
synced 2026-01-11 17:42:48 +00:00
client - use mobx as state container
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import axios, { AxiosInstance, AxiosResponse } from 'axios';
|
||||
import userStore from '../stores/user-store';
|
||||
|
||||
// create our own instance of axios so we can set request headers
|
||||
const ax: AxiosInstance = axios.create();
|
||||
@@ -9,11 +10,10 @@ ax.interceptors.response.use(
|
||||
return config;
|
||||
},
|
||||
(error: any) => {
|
||||
// TODO: log the user out if they get a 401
|
||||
// if code is unauthorized (401) then logout if already logged in
|
||||
// if (error.response.status === 401 && store.getState().user.loggedIn) {
|
||||
// store.dispatch(userActions.logout());
|
||||
// }
|
||||
if (error.response.status === 401 && userStore.user) {
|
||||
userStore.resetUser();
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user