dressed_for_succes_store/frontend/hooks/use-auth.tsx

15 lines
413 B
TypeScript

"use client";
import React, { useContext } from 'react';
import { AuthContext } from '../lib/auth';
// Создаем собственную реализацию хука useAuth
export function useAuth() {
const context = useContext(AuthContext);
if (context === undefined) {
throw new Error("useAuth должен использоваться внутри AuthProvider");
}
return context;
}