Skeleton: Delegate data fetching to specific routes and only load what's needed
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { fetch_drivers, fetch_raceresults, fetch_races } from "$lib/fetch";
|
||||
import type { PageLoad } from "../../$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
return {
|
||||
drivers: fetch_drivers(fetch),
|
||||
races: fetch_races(fetch),
|
||||
raceresults: fetch_raceresults(fetch),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
import { fetch_drivers, fetch_teams } from "$lib/fetch";
|
||||
import type { PageLoad } from "../../../$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
return {
|
||||
teams: fetch_teams(fetch),
|
||||
drivers: fetch_drivers(fetch),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { fetch_races } from "$lib/fetch";
|
||||
import type { PageLoad } from "../../../$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
return {
|
||||
races: fetch_races(fetch),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { fetch_drivers, fetch_races, fetch_substitutions } from "$lib/fetch";
|
||||
import type { PageLoad } from "../../../$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
return {
|
||||
races: fetch_races(fetch),
|
||||
drivers: fetch_drivers(fetch),
|
||||
substitutions: fetch_substitutions(fetch),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { fetch_teams } from "$lib/fetch";
|
||||
import type { PageLoad } from "../../../$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
return {
|
||||
teams: fetch_teams(fetch),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user