Files
ocdp-go/frontend/src/app/providers/AuthContext.ts
mangomqy c5e51ed069 ocdp v1
2025-11-13 02:54:06 +00:00

24 lines
500 B
TypeScript

/**
* Auth Context
* Authentication context - separated for Fast Refresh compatibility
*/
import { createContext } from "react";
import type { AuthResponse } from "@/api";
export interface User {
username: string;
role?: string;
}
export interface AuthContextType {
token: string | null;
user: User | null;
isAuthenticated: boolean;
login: (response: AuthResponse) => void;
logout: () => void;
}
export const AuthContext = createContext<AuthContextType | undefined>(undefined);