UNPKG

starkon

Version:

Create a Next.js project with Starkon

15 lines (10 loc) 327 B
'use client' import { useContext } from 'react' import { AuthContext, type AuthContextType } from '@/providers/AuthProvider' export const useAuth = (): AuthContextType => { const context = useContext(AuthContext) if (!context) { throw new Error('useAuth must be used within an AuthProvider') } return context }