File
Blob: src/client/auth/use-auth.ts
| 1 | import { useContext } from "react"; |
| 2 | import { AuthContext, type AuthContextValue } from "@/client/auth/auth-context"; |
| 3 | |
| 4 | export const useAuth = (): AuthContextValue => { |
| 5 | const value = useContext(AuthContext); |
| 6 | if (!value) { |
| 7 | throw new Error("useAuth must be used within AuthProvider."); |
| 8 | } |
| 9 | |
| 10 | return value; |
| 11 | }; |