mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-21 11:20:17 -04:00
Merge branch 'main' of https://github.com/myfatemi04/Carpool-Frontend into main
This commit is contained in:
commit
b864cf6ca9
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user