Files
Yuuki-chat/lib/auth-context.tsx
v0 71ef3bc46f feat: migrate to open HuggingFace API and remove auth
Remove auth logic and switch to open API endpoint.

Co-authored-by: awa <212803252+aguitauwu@users.noreply.github.com>
2026-02-11 23:05:39 +00:00

30 lines
726 B
TypeScript

"use client";
import React, { createContext, useContext } from "react";
interface AuthContextValue {
logout: () => void;
}
const AuthContext = createContext<AuthContextValue | undefined>(undefined);
export function AuthProvider({ children }: { children: React.ReactNode }) {
const logout = () => {
// No-op since there's no authentication needed.
// Kept for compatibility with components that reference it.
window.location.reload();
};
return (
<AuthContext.Provider value={{ logout }}>
{children}
</AuthContext.Provider>
);
}
export function useAuth() {
const ctx = useContext(AuthContext);
if (!ctx) throw new Error("useAuth must be used within AuthProvider");
return ctx;
}