Correction déconnexion web
This commit is contained in:
parent
9176eb014f
commit
d1adba04da
@ -35,7 +35,7 @@ export default function LoginProvider({ loginRedirect, children }: Props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si on est pas connecté⋅e, on reste sur la fenêtre de connexion
|
// Si on est pas connecté⋅e, on reste sur la fenêtre de connexion
|
||||||
if (!auth.loggedIn && route.pathname !== loginRedirect)
|
if ((!auth.loggedIn || !auth.token) && route.pathname !== loginRedirect)
|
||||||
router.navigate(loginRedirect)
|
router.navigate(loginRedirect)
|
||||||
})()
|
})()
|
||||||
}, [auth, authLogin, router, route])
|
}, [auth, authLogin, router, route])
|
||||||
@ -58,6 +58,8 @@ export default function LoginProvider({ loginRedirect, children }: Props) {
|
|||||||
const password = SecureStore.getItem('apiPassword')
|
const password = SecureStore.getItem('apiPassword')
|
||||||
if (password)
|
if (password)
|
||||||
loginMutation.mutate({ name, password })
|
loginMutation.mutate({ name, password })
|
||||||
|
else
|
||||||
|
authLogin({ name: name, token: null })
|
||||||
}, waitTime)
|
}, waitTime)
|
||||||
return () => clearTimeout(timeout)
|
return () => clearTimeout(timeout)
|
||||||
}, [auth, authLogin])
|
}, [auth, authLogin])
|
||||||
|
Loading…
Reference in New Issue
Block a user