Add fetch to missing prototypes
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Alessio Davoli 2023-12-22 12:53:39 +01:00
parent dba6eced88
commit 5d56b382ce
3 changed files with 7 additions and 7 deletions

View file

@ -2,10 +2,10 @@
import { getRouteCategories } from '$lib/repo.js'; import { getRouteCategories } from '$lib/repo.js';
import { error } from '@sveltejs/kit'; import { error } from '@sveltejs/kit';
export async function load() { export async function load({fetch}) {
let categories = []; let categories = [];
try { try {
categories = await getRouteCategories(); categories = await getRouteCategories(fetch);
} catch (ex) { } catch (ex) {
error(500); error(500);
} }

View file

@ -1,8 +1,8 @@
import { getRouteByCategory, getRouteCategories } from '$lib/repo.js'; import { getRouteByCategory, getRouteCategories } from '$lib/repo.js';
import { error } from '@sveltejs/kit'; import { error } from '@sveltejs/kit';
export async function load({ params }) { export async function load({ fetch, params }) {
const categories: App.Category[] = await getRouteCategories(); const categories: App.Category[] = await getRouteCategories(fetch);
const categoryId = Number(params.slug); const categoryId = Number(params.slug);
const category: App.Category = categories.find(c => c.id === categoryId) as App.Category; const category: App.Category = categories.find(c => c.id === categoryId) as App.Category;
@ -13,7 +13,7 @@ export async function load({ params }) {
const toReturn = { const toReturn = {
category: category.name_it, category: category.name_it,
routes: await getRouteByCategory(categoryId), routes: await getRouteByCategory(fetch, categoryId),
} }
return toReturn; return toReturn;

View file

@ -1,9 +1,9 @@
import { getRoute } from '$lib/repo.js'; import { getRoute } from '$lib/repo.js';
import { error } from '@sveltejs/kit'; import { error } from '@sveltejs/kit';
export async function load({ params }) { export async function load({ fetch, params }) {
const routeId = Number(params.slug); const routeId = Number(params.slug);
const route = await getRoute(routeId); const route = await getRoute(fetch, routeId);
if (!route) { if (!route) {
error(404); error(404);