Skip to content
File

Blob: src/client/auth/use-auth.ts

typescript12 lines
1import { useContext } from "react";
2import { AuthContext, type AuthContextValue } from "@/client/auth/auth-context";
3 
4export 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};