Spaces:
Sleeping
Sleeping
David Prince
fix: add all missing local module stubs (remote_mcp_registry, mcp_auth, mcp_transport, etc)
cce8120 | "use client"; | |
| import {createContext,useContext,useEffect,useState} from "react"; | |
| import * as auth from "../services/auth/auth"; | |
| const AuthContext=createContext(null); | |
| export function AuthProvider({children}){ | |
| const [user,setUser]=useState(null); | |
| useEffect(()=>{ | |
| auth.profile() | |
| .then(setUser) | |
| .catch(()=>setUser(null)); | |
| },[]); | |
| return( | |
| <AuthContext.Provider value={{user,setUser,...auth}}> | |
| {children} | |
| </AuthContext.Provider> | |
| ); | |
| } | |
| export function useAuth(){ | |
| return useContext(AuthContext); | |
| } | |