Files
FarmaFinder/apps/frontend-mobile/hooks/useAuth.ts
Antoni Nuñez Romeu 190b3d163d
Run Tests on Branches / Backend Tests (push) Successful in 3m38s
Run Tests on Branches / Frontend Tests (push) Successful in 3m28s
Restructure with Turborepo
2026-07-06 15:51:53 +02:00

20 lines
378 B
TypeScript

import { useEffect } from 'react';
import { useAuthStore } from '../store/authStore';
export function useAuth() {
const { user, isLoading, isAuthenticated, login, logout, checkAuth } = useAuthStore();
useEffect(() => {
checkAuth();
}, []);
return {
user,
isLoading,
isAuthenticated,
login,
logout,
isAdmin: user?.is_admin ?? false,
};
}