From d1adba04dafe6e5233ef6aef49c0c6321e5e5ac2 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Wed, 11 Dec 2024 16:23:17 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20d=C3=A9connexion=20web?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/LoginProvider.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/components/LoginProvider.tsx b/client/components/LoginProvider.tsx index 0ceab3b..336b9ec 100644 --- a/client/components/LoginProvider.tsx +++ b/client/components/LoginProvider.tsx @@ -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])