chore: fix push notif
This commit is contained in:
@@ -8,7 +8,6 @@ import {
|
||||
clearAllAuth,
|
||||
} from './tokenStorage';
|
||||
import { extractUsernameFromToken, extractRoleFromToken, isTokenExpired } from './jwtUtils';
|
||||
import { removePushTokenFromBackend } from '../services/pushNotifications';
|
||||
|
||||
export type UserRole = 'client' | 'admin' | 'cabine' | 'livreur' | null;
|
||||
|
||||
@@ -137,8 +136,6 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
};
|
||||
|
||||
const logout = async () => {
|
||||
// Supprimer le push token du backend avant de se déconnecter
|
||||
try { await removePushTokenFromBackend(); } catch { /* silencieux */ }
|
||||
await clearAllAuth();
|
||||
setState({
|
||||
token: null,
|
||||
|
||||
@@ -17,8 +17,8 @@ import { useNotifications } from "../context/NotificationContext";
|
||||
import { useAuth } from "../auth/AuthContext";
|
||||
import { useTheme } from "../context/ThemeContext";
|
||||
import { logoutUser } from "../api/api";
|
||||
import { removePushTokenFromBackend } from "../services/pushNotifications";
|
||||
import type { ClientNotification } from "../api/api";
|
||||
import { removePushTokenFromBackend } from "../services/pushNotifications";
|
||||
import { fontSize, spacing, borderRadius } from "../theme";
|
||||
import Toast from "../components/ui/Toast";
|
||||
import type { ClientTabParamList, ClientStackParamList } from "./types";
|
||||
@@ -76,6 +76,7 @@ function ClientTabs() {
|
||||
}, [navigateToOrder, navigation, clearNavigateToOrder]);
|
||||
|
||||
const handleLogout = async () => {
|
||||
try { await removePushTokenFromBackend(); } catch { /* silencieux */ }
|
||||
await logoutUser();
|
||||
await logout();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user