1
0
mirror of https://github.com/mgerb/classic-wow-forums synced 2026-01-11 17:42:48 +00:00

realm list page done

This commit is contained in:
2018-01-07 15:54:22 -06:00
parent a9e5b185ee
commit 98f682fdce
10 changed files with 267 additions and 8 deletions

30
client/app/axios/axios.ts Normal file
View File

@@ -0,0 +1,30 @@
import axios, { AxiosInstance, AxiosResponse } from 'axios';
// create our own instance of axios so we can set request headers
const ax: AxiosInstance = axios.create();
// response interceptors
ax.interceptors.response.use(
(config: AxiosResponse) => {
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());
// }
return Promise.reject(error);
},
);
export function setAuthorizationHeader(jwt: string): void {
ax.defaults.headers.common['Authorization'] = jwt;
}
export function resetAuthorizationHeader(): void {
ax.defaults.headers.common['Authorization'] = '';
}
export default ax;