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 () => {