9 lines
254 B
TypeScript
9 lines
254 B
TypeScript
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;
|
|
};
|