mirror of
https://github.com/TheRealOwenRees/chess-scribe-website.git
synced 2026-07-23 01:46:57 +00:00
do not set isLoggedInBoolean since it is now removed
This commit is contained in:
+6
-20
@@ -1,6 +1,11 @@
|
|||||||
import { useServerFn } from "@tanstack/react-start";
|
import { useServerFn } from "@tanstack/react-start";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useLichessUser } from "#/context/LichessUserContext.tsx";
|
import { useLichessUser } from "#/context/LichessUserContext.tsx";
|
||||||
|
import type {
|
||||||
|
ITokenData,
|
||||||
|
IUserStudy,
|
||||||
|
IUserStudyChapter,
|
||||||
|
} from "#/interfaces.ts";
|
||||||
import {
|
import {
|
||||||
getSession,
|
getSession,
|
||||||
getStudyChapters,
|
getStudyChapters,
|
||||||
@@ -15,25 +20,6 @@ import { getHeaders } from "#/utils/pgnUtils.ts";
|
|||||||
|
|
||||||
type Status = "loading" | "success" | "error";
|
type Status = "loading" | "success" | "error";
|
||||||
|
|
||||||
interface ITokenData {
|
|
||||||
access_token: string;
|
|
||||||
expires_in: number;
|
|
||||||
token_type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type IUserStudy = {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
createdAt: number;
|
|
||||||
updatedAt: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface IUserStudyChapter {
|
|
||||||
chapterId: string;
|
|
||||||
name: string;
|
|
||||||
pgn: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useLichess = () => {
|
export const useLichess = () => {
|
||||||
const { user, setUser } = useLichessUser();
|
const { user, setUser } = useLichessUser();
|
||||||
const [userStudies, setUserStudies] = useState<IUserStudy[]>([]);
|
const [userStudies, setUserStudies] = useState<IUserStudy[]>([]);
|
||||||
@@ -65,7 +51,7 @@ export const useLichess = () => {
|
|||||||
token: string;
|
token: string;
|
||||||
}) => {
|
}) => {
|
||||||
await setSessionFn({ data: { username, id, token } });
|
await setSessionFn({ data: { username, id, token } });
|
||||||
setUser({ username, id, isLoggedIn: true });
|
setUser({ username, id });
|
||||||
};
|
};
|
||||||
|
|
||||||
const getLichessUser = async ({ tokenData }: { tokenData: ITokenData }) => {
|
const getLichessUser = async ({ tokenData }: { tokenData: ITokenData }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user