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