auth work
This commit is contained in:
@@ -30,8 +30,9 @@ export const AuthUserProvider = ({children}: PropsWithChildren) => {
|
||||
} catch (error) {
|
||||
// @ts-expect-error 401 error to redirect
|
||||
if (error.response.status === 401) {
|
||||
console.info('no user login')
|
||||
if (!['/connexion', '/sinscrire'].includes(window.location.pathname)) {
|
||||
const page = window.location.pathname.split('/')[1]
|
||||
if (!['connexion', 'sinscrire', 'reset'].includes(page)) {
|
||||
console.info('no user login')
|
||||
window.location.href = '/connexion'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user