17 lines
501 B
TypeScript
17 lines
501 B
TypeScript
import { useEffect } from 'react';
|
|
import { useAuthStore } from '@/stores/auth';
|
|
|
|
/**
|
|
* Hook pour gérer l'authentification et la persistance de session
|
|
* Utilise le store Zustand unifié pour l'état d'authentification
|
|
*/
|
|
export function useAuth() {
|
|
const { isAuthenticated, isLoading, checkAuthStatus } = useAuthStore();
|
|
|
|
useEffect(() => {
|
|
// Vérifier le statut d'authentification au chargement
|
|
checkAuthStatus();
|
|
}, [checkAuthStatus]);
|
|
|
|
return { isAuthenticated, isLoading };
|
|
}
|