From df911efde15a26e7c4ef8791697d14928664734c Mon Sep 17 00:00:00 2001 From: Azmog <80716388+AzmogEx@users.noreply.github.com> Date: Fri, 19 Jun 2026 00:34:15 +0200 Subject: [PATCH] =?UTF-8?q?fix(mobile):=20d=C3=A9connexion=20locale=20d'ab?= =?UTF-8?q?ord=20(instantan=C3=A9e,=20fiable=20hors-ligne)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit L'appel API /auth/logout pouvait bloquer la déconnexion ; on purge le token et réinitialise l'état immédiatement, puis on notifie le serveur en arrière-plan. Co-Authored-By: Claude Opus 4.8 (1M context) --- mobile/lib/auth-store.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mobile/lib/auth-store.ts b/mobile/lib/auth-store.ts index 9876fe8..53fde95 100644 --- a/mobile/lib/auth-store.ts +++ b/mobile/lib/auth-store.ts @@ -59,11 +59,11 @@ export const useAuthStore = create()((set) => ({ }, logout: async () => { - try { - await api.post('/auth/logout'); - } catch {} + // Déconnexion locale d'abord (instantanée et fiable, même hors-ligne). await SecureStore.deleteItemAsync('cesizen_token'); set({ user: null, token: null, isAuthenticated: false }); + // Notifie le serveur en arrière-plan (best-effort, sans bloquer l'UI). + api.post('/auth/logout').catch(() => {}); }, fetchUser: async () => {