mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
Merge branch 'main' into feat/addons
This commit is contained in:
commit
6b605078df
@ -490,6 +490,8 @@ export const routes = [
|
||||
layout: 'main',
|
||||
menu: {},
|
||||
},
|
||||
/* If you update this route path, make sure you update the path in SWRProvider.tsx */
|
||||
|
||||
{
|
||||
path: '/login',
|
||||
title: 'Log in',
|
||||
@ -499,6 +501,7 @@ export const routes = [
|
||||
layout: 'standalone',
|
||||
menu: {},
|
||||
},
|
||||
/* If you update this route path, make sure you update the path in SWRProvider.tsx */
|
||||
{
|
||||
path: '/new-user',
|
||||
title: 'New user',
|
||||
@ -508,6 +511,7 @@ export const routes = [
|
||||
layout: 'standalone',
|
||||
menu: {},
|
||||
},
|
||||
/* If you update this route path, make sure you update the path in SWRProvider.tsx */
|
||||
{
|
||||
path: '/reset-password',
|
||||
title: 'reset-password',
|
||||
|
@ -22,17 +22,23 @@ const SWRProvider: React.FC<ISWRProviderProps> = ({
|
||||
const handleFetchError = error => {
|
||||
setShowLoader(false);
|
||||
if (error.status === 401) {
|
||||
cache.clear();
|
||||
const path = location.pathname;
|
||||
// Only populate user with authDetails if 401 and
|
||||
// error is not invalid token
|
||||
if (error?.info?.name !== INVALID_TOKEN_ERROR) {
|
||||
mutate(USER_CACHE_KEY, { ...error.info }, false);
|
||||
}
|
||||
if (path === '/login') {
|
||||
|
||||
if (
|
||||
path === '/login' ||
|
||||
path === '/new-user' ||
|
||||
path === '/reset-password'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
cache.clear();
|
||||
|
||||
history.push('/login');
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user