fix: stop redirecting to login on /login

This commit is contained in:
Ali BARIN
2023-03-07 20:27:33 +00:00
parent 7676bc5836
commit c8187e52bb

View File

@@ -33,21 +33,25 @@ const createErrorLink = (callback: CreateLinkOptions['onError']): ApolloLink =>
callback?.(message);
}
console.log(
console.error(
`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
);
if (message === NOT_AUTHORISED) {
setItem('token', '');
if (window.location.pathname !== URLS.LOGIN) {
window.location.href = URLS.LOGIN;
}
}
});
if (networkError) {
if (autoSnackbar) {
callback?.(networkError.toString());
}
console.log(`[Network error]: ${networkError}`);
console.error(`[Network error]: ${networkError}`);
}
});