fix: stop redirecting to login on /login
This commit is contained in:
@@ -33,21 +33,25 @@ const createErrorLink = (callback: CreateLinkOptions['onError']): ApolloLink =>
|
|||||||
callback?.(message);
|
callback?.(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
console.error(
|
||||||
`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
|
`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (message === NOT_AUTHORISED) {
|
if (message === NOT_AUTHORISED) {
|
||||||
setItem('token', '');
|
setItem('token', '');
|
||||||
|
|
||||||
|
if (window.location.pathname !== URLS.LOGIN) {
|
||||||
window.location.href = URLS.LOGIN;
|
window.location.href = URLS.LOGIN;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (networkError) {
|
if (networkError) {
|
||||||
if (autoSnackbar) {
|
if (autoSnackbar) {
|
||||||
callback?.(networkError.toString());
|
callback?.(networkError.toString());
|
||||||
}
|
}
|
||||||
console.log(`[Network error]: ${networkError}`);
|
|
||||||
|
console.error(`[Network error]: ${networkError}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user