Auth provider added to the project

This commit is contained in:
مهرزاد قدرتی
2025-08-16 15:42:58 +03:30
parent 0548118208
commit 8a41aad9b9
10 changed files with 165 additions and 85 deletions

8
src/hooks/useAuth.ts Normal file
View File

@@ -0,0 +1,8 @@
import { AuthContext } from '@/contexts/AuthContext';
import { useContext } from 'react';
export const useAuth = () => {
const ctx = useContext(AuthContext);
if (!ctx) throw new Error('useAuth must be used within an AuthProvider');
return ctx;
};