add context

This commit is contained in:
2026-06-07 23:07:59 +02:00
parent 82c24ba9d4
commit ba05fbedd3
3 changed files with 70 additions and 18 deletions
+5 -3
View File
@@ -1,14 +1,14 @@
import { useServerFn } from "@tanstack/react-start";
import { useState } from "react";
import { useLichessUser } from "#/context/LichessUserContext.tsx";
import { getToken, login } from "#/server/lichess.ts";
export const useLichess = () => {
const [lichessUser, setLichessUser] = useState();
const { user, setUser, logout } = useLichessUser();
const triggerLogin = useServerFn(login);
const trigggerGetToken = useServerFn(getToken);
console.log("Lichess User:", lichessUser);
console.log("Lichess User:", user);
const lichessTokenVerification = async ({ code }) => {
await trigggerGetToken();
@@ -21,6 +21,8 @@ export const useLichess = () => {
const lichessLogout = () => {
console.log("Lichess Logout");
// TODO remove cookies
logout();
};
return {