mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-03 13:26:48 +03:00
26 lines
559 B
TypeScript
26 lines
559 B
TypeScript
import { createContext } from "react";
|
|||
|
|
|
||
|
|
export interface AuthState {
|
||
|
|
user: { username: string; role: string | null } | null;
|
||
|
|
allowedCameras: string[];
|
||
|
|
isLoading: boolean;
|
||
|
|
isAuthenticated: boolean; // true if auth is required
|
||
|
|
}
|
||
|
|
|
||
|
|
interface AuthContextType {
|
||
|
|
auth: AuthState;
|
||
|
|
login: (user: AuthState["user"]) => void;
|
||
|
|
logout: () => void;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const AuthContext = createContext<AuthContextType>({
|
||
|
|
auth: {
|
||
|
|
user: null,
|
||
|
|
allowedCameras: [],
|
||
|
|
isLoading: true,
|
||
|
|
isAuthenticated: false,
|
||
|
|
},
|
||
|
|
login: () => {},
|
||
|
|
logout: () => {},
|
||
|
|
});
|