11 lines
280 B
TypeScript
11 lines
280 B
TypeScript
import { useContext } from 'react';
|
|
import { AuthContext } from './providers/JWTProvider';
|
|
|
|
export const useAuthContext = () => {
|
|
const context = useContext(AuthContext);
|
|
|
|
if (!context) throw new Error('useAuthContext must be used within AuthProvider');
|
|
|
|
return context;
|
|
};
|