fix(mobile): déconnexion locale d'abord (instantanée, fiable hors-ligne)
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) <noreply@anthropic.com>
This commit is contained in:
@@ -59,11 +59,11 @@ export const useAuthStore = create<AuthState>()((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 () => {
|
||||
|
||||
Reference in New Issue
Block a user