Barazo default frontend barazo.forum
at main 19 lines 491 B view raw
1/** 2 * Hook to access auth context. 3 * Throws if used outside AuthProvider. 4 * @see specs/prd-web.md Section M3 (Auth Flow) 5 */ 6 7'use client' 8 9import { useContext } from 'react' 10import { AuthContext } from '@/context/auth-context' 11import type { AuthContextValue } from '@/context/auth-context' 12 13export function useAuth(): AuthContextValue { 14 const context = useContext(AuthContext) 15 if (!context) { 16 throw new Error('useAuth must be used within an AuthProvider') 17 } 18 return context 19}