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])