File size: 308 Bytes
f1dd159
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import { useContext } from "react";

import { AuthContext, type AuthContextValue } from "@/shared/auth/auth-state";

export function useAuth(): AuthContextValue {
  const value = useContext(AuthContext);
  if (!value) {
    throw new Error("useAuth must be used inside AuthProvider");
  }
  return value;
}