Skeleton: Use writable store for pbUser object

This commit is contained in:
2025-03-14 23:56:52 +01:00
parent 614e2becc4
commit 43e8a00aeb
13 changed files with 81 additions and 50 deletions

View File

@ -159,11 +159,12 @@ export const fetch_visibleracepicks = async (
export const fetch_currentracepick = async (
fetch: (_: any) => Promise<Response>,
): Promise<RacePick | undefined> => {
if (!pbUser) return undefined;
const user: User | undefined = get(pbUser);
if (!user) return undefined;
const currentpickeduser: CurrentPickedUser = await pb
.collection("currentpickedusers")
.getOne(pbUser.id, { fetch: fetch });
.getOne(user.id, { fetch: fetch });
if (!currentpickeduser.picked) return undefined;
@ -204,11 +205,12 @@ export const fetch_hottakes = async (fetch: (_: any) => Promise<Response>): Prom
export const fetch_currentseasonpick = async (
fetch: (_: any) => Promise<Response>,
): Promise<SeasonPick | undefined> => {
if (!pbUser) return undefined;
const user: User | undefined = get(pbUser);
if (!user) return undefined;
const seasonpickeduser: CurrentPickedUser = await pb
.collection("seasonpickedusers")
.getOne(pbUser.id, { fetch: fetch });
.getOne(user.id, { fetch: fetch });
if (!seasonpickeduser.picked) return undefined;