27 lines
522 B
TypeScript
27 lines
522 B
TypeScript
import type { PageLoad } from './$types';
|
|
|
|
export interface RouteMapIndex {
|
|
routeId: string | number;
|
|
routeStart: string;
|
|
routeEnd: string;
|
|
created: string;
|
|
checked: string;
|
|
contents: string[];
|
|
}
|
|
|
|
export const load: PageLoad = async ({ fetch }) => {
|
|
const response = await fetch('map-index.json');
|
|
|
|
if (!response.ok) {
|
|
return { maps: [] };
|
|
}
|
|
|
|
const maps = await response.json();
|
|
|
|
return {
|
|
maps: maps.sort((a: any, b: any) => {
|
|
return Number(a.routeId) - Number(b.routeId);
|
|
}) as RouteMapIndex[]
|
|
};
|
|
};
|