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 { 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);
}

View file

@ -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;

View file

@ -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);