Add:
- context/ - hook/ - types/ ### No Issue
This commit is contained in:
10
hook/use-auth.ts
Normal file
10
hook/use-auth.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { AuthContext } from "@/context/AuthContext";
|
||||
import { useContext } from "react";
|
||||
|
||||
export const useAuth = () => {
|
||||
const context = useContext(AuthContext);
|
||||
if (!context) {
|
||||
throw new Error("useAuth must be used within an AuthProvider");
|
||||
}
|
||||
return context;
|
||||
};
|
||||
Reference in New Issue
Block a user