Not allowed to actually do it

This commit is contained in:
2026-02-05 17:30:44 +00:00
parent 76f48fa288
commit 2fa8a7872e
5 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import type { PageLoad } from '/$types';
import { error } from '@sveltejs/kit';
export const load: PageLoad = async ({ params, fetch }) => {
const { slug } = params;
try {
const res = await fetch(`/mapFiles/json/${slug}.json`);
if (!res.ok) {
throw error(404, {
message: `Route ${slug} not found`
});
}
const rawData = await res.json();
return {
route: rawData,
slug: slug,
};
} catch (err) {
console.error(`Error loading map ${slug}: `, err);
throw error(500, {
message: `Failed to parse map data for ${slug}`
});
}
};