import { error } from '@sveltejs/kit';
import { pb } from '$lib/pb';

export const ssr = false;

export async function load({ params }) {
	try {
		const station = await pb
			.collection('stations')
			.getFirstListItem(`qr_id = "${params.id}"`, { expand: 'tenant' });
		return { station };
	} catch {
		throw error(404, 'Station nicht gefunden');
	}
}
