Skeleton: Fetch RaceResults asynchronously in root layout

This commit is contained in:
2025-02-17 15:58:07 +01:00
parent e58b94022a
commit 9e39547936
4 changed files with 23 additions and 36 deletions

View File

@ -1,18 +0,0 @@
import { pb } from "$lib/pocketbase";
import type { RaceResult } from "$lib/schema";
import type { PageLoad } from "../../$types";
export const load: PageLoad = async ({ fetch }) => {
// TODO: Duplicated code from racepicks/+page.server.ts
const fetch_raceresults = async (): Promise<RaceResult[]> => {
const raceresults: RaceResult[] = await pb
.collection("raceresultsdesc")
.getFullList({ fetch: fetch });
return raceresults;
};
return {
results: await fetch_raceresults(),
};
};