Auth provider added to the project
This commit is contained in:
8
src/hooks/useAuth.ts
Normal file
8
src/hooks/useAuth.ts
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user