mirror of
https://github.com/TheRealOwenRees/chess-scribe-website.git
synced 2026-07-23 01:46:57 +00:00
add context
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user