This commit is contained in:
Joshua Hsueh 2021-04-10 23:26:57 -04:00
commit b864cf6ca9

View File

@ -35,7 +35,7 @@ export function graphql(query: string, variables?: any) {
}) })
.catch((error) => { .catch((error) => {
if (error.response.status === 401) { if (error.response.status === 401) {
localStorage.removeItem('session_id'); localStorage.removeItem('session_token');
window.location.pathname = '/'; window.location.pathname = '/';
} else { } else {
reject(new APIError('/api/users/@me', error.response.data.error)); reject(new APIError('/api/users/@me', error.response.data.error));
@ -53,7 +53,7 @@ export function makeAPIPostCall(url: string, data?: any) {
.then((successfulResponse) => resolve(successfulResponse)) .then((successfulResponse) => resolve(successfulResponse))
.catch((error) => { .catch((error) => {
if (error.response?.status === 401) { if (error.response?.status === 401) {
localStorage.removeItem('session_id'); localStorage.removeItem('session_token');
window.location.pathname = '/'; window.location.pathname = '/';
} else { } else {
reject(new APIError(url, error.response?.data?.error)); reject(new APIError(url, error.response?.data?.error));
@ -75,7 +75,7 @@ export function makeAPIGetCall(
.then((successfulResponse) => resolve(successfulResponse)) .then((successfulResponse) => resolve(successfulResponse))
.catch((error) => { .catch((error) => {
if (error.response?.status === 401) { if (error.response?.status === 401) {
localStorage.removeItem('session_id'); localStorage.removeItem('session_token');
window.location.pathname = '/'; window.location.pathname = '/';
} else { } else {
reject(error); reject(error);
@ -93,7 +93,7 @@ export function makeAPIDeleteCall(url: string) {
.then((successfulResponse) => resolve(successfulResponse)) .then((successfulResponse) => resolve(successfulResponse))
.catch((error) => { .catch((error) => {
if (error.response?.status === 401) { if (error.response?.status === 401) {
localStorage.removeItem('session_id'); localStorage.removeItem('session_token');
} else { } else {
reject(new APIError(url, error.response.data.error)); reject(new APIError(url, error.response.data.error));
} }