this repo has no description
1import { useContext } from 'react';
2import { AuthContext } from '../context/AuthContext';
3import type { AuthContextValue } from '../context/AuthContext';
4
5export function useAuth(): AuthContextValue {
6 const context = useContext(AuthContext);
7 if (!context) {
8 throw new Error('useAuth must be used within an AuthProvider');
9 }
10 return context;
11}