Add initial logic for 'boards'

This commit is contained in:
2026-03-17 20:04:38 +00:00
parent 3240560a0b
commit 64bc5b979d
8 changed files with 79 additions and 11 deletions

37
src/routes/board/+page.ts Normal file
View File

@@ -0,0 +1,37 @@
import { LOCATIONS } from '$lib/locations-object.svelte';
import type { PageLoad } from './$types';
import { error } from '@sveltejs/kit';
export const load: PageLoad = async ({ url }) => {
const locId = url.searchParams.get('loc');
if (!LOCATIONS.loaded) {
await LOCATIONS.init(fetch);
}
let title: string = "";
if (!locId) {
error(400, {
message: 'Location not provided',
owlCode: 'NO_LOCATION_IN_PATH',
});
}
if (locId) {
const location = LOCATIONS.find(locId);
if (location) {
title = location.n || location.t;
} else {
error(404, {
message: `Location (${locId}) not found`,
owlCode: 'INVALID_LOCATION_CODE',
});
}
}
return {
title,
location,
};
};