Correction déconnexion web

This commit is contained in:
Emmy D'Anello 2024-12-11 16:23:17 +01:00
parent 9176eb014f
commit d1adba04da
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -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
if (!auth.loggedIn && route.pathname !== loginRedirect)
if ((!auth.loggedIn || !auth.token) && route.pathname !== loginRedirect)
router.navigate(loginRedirect)
})()
}, [auth, authLogin, router, route])
@ -58,6 +58,8 @@ export default function LoginProvider({ loginRedirect, children }: Props) {
const password = SecureStore.getItem('apiPassword')
if (password)
loginMutation.mutate({ name, password })
else
authLogin({ name: name, token: null })
}, waitTime)
return () => clearTimeout(timeout)
}, [auth, authLogin])