15 lines
356 B
TypeScript
15 lines
356 B
TypeScript
import { use } from 'react';
|
|
import { AuthContext } from '../context/auth-context';
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
export function useAuthContext() {
|
|
const context = use(AuthContext);
|
|
|
|
if (!context) {
|
|
throw new Error('useAuthContext: Context must be used inside AuthProvider');
|
|
}
|
|
|
|
return context;
|
|
}
|