basic login / logout lichess user

This commit is contained in:
2026-06-08 12:23:20 +02:00
parent ba05fbedd3
commit d1cdc7764b
7 changed files with 186 additions and 64 deletions
+3 -7
View File
@@ -9,13 +9,13 @@ import {
interface ILichessUser {
username: string;
id: string;
isLoggedIn: boolean;
}
interface ILichessUserContextType {
user: ILichessUser | null;
setUser: Dispatch<SetStateAction<ILichessUser | null>>;
logout: () => void;
setUser: Dispatch<SetStateAction<ILichessUser | null>>
}
const LichessUserContext = createContext<ILichessUserContextType | undefined>(
@@ -25,14 +25,10 @@ const LichessUserContext = createContext<ILichessUserContextType | undefined>(
export const LichessUserProvider = ({ children }: { children: ReactNode }) => {
const [user, setUser] = useState<ILichessUser | null>(null);
const logout = () => {
setUser(null);
};
// TODO useEffect to check and login user on mount
return (
<LichessUserContext.Provider value={{ user, setUser, logout }}>
<LichessUserContext.Provider value={{ user, setUser }}>
{children}
</LichessUserContext.Provider>
);