1
0
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:
2018-01-09 20:24:09 -06:00
parent 8a39f687a8
commit 2d6ff0875f
13 changed files with 100 additions and 42 deletions

View File

@@ -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);
},