diff --git a/frontend/src/routes/+page.ts b/frontend/src/routes/+page.ts index a2271f8..eb0d1ef 100644 --- a/frontend/src/routes/+page.ts +++ b/frontend/src/routes/+page.ts @@ -2,10 +2,10 @@ import { getRouteCategories } from '$lib/repo.js'; import { error } from '@sveltejs/kit'; -export async function load() { +export async function load({fetch}) { let categories = []; try { - categories = await getRouteCategories(); + categories = await getRouteCategories(fetch); } catch (ex) { error(500); } diff --git a/frontend/src/routes/paths/[slug]/+page.ts b/frontend/src/routes/paths/[slug]/+page.ts index acb0966..7a2f01e 100644 --- a/frontend/src/routes/paths/[slug]/+page.ts +++ b/frontend/src/routes/paths/[slug]/+page.ts @@ -1,8 +1,8 @@ import { getRouteByCategory, getRouteCategories } from '$lib/repo.js'; import { error } from '@sveltejs/kit'; -export async function load({ params }) { - const categories: App.Category[] = await getRouteCategories(); +export async function load({ fetch, params }) { + const categories: App.Category[] = await getRouteCategories(fetch); const categoryId = Number(params.slug); const category: App.Category = categories.find(c => c.id === categoryId) as App.Category; @@ -13,7 +13,7 @@ export async function load({ params }) { const toReturn = { category: category.name_it, - routes: await getRouteByCategory(categoryId), + routes: await getRouteByCategory(fetch, categoryId), } return toReturn; diff --git a/frontend/src/routes/routes/[slug]/+page.ts b/frontend/src/routes/routes/[slug]/+page.ts index bc240e2..db0c3da 100644 --- a/frontend/src/routes/routes/[slug]/+page.ts +++ b/frontend/src/routes/routes/[slug]/+page.ts @@ -1,9 +1,9 @@ import { getRoute } from '$lib/repo.js'; import { error } from '@sveltejs/kit'; -export async function load({ params }) { +export async function load({ fetch, params }) { const routeId = Number(params.slug); - const route = await getRoute(routeId); + const route = await getRoute(fetch, routeId); if (!route) { error(404);