Files
website/src/routes/trackers/trains/random/+server.ts
Stan Runge 5f940e8196
All checks were successful
Deploy production / deploy (push) Successful in 1m9s
trains: pokedex pages (builders, operators, countries, detail, random) and registrations
2026-10-25 00:11:50 +00:00

10 lines
390 B
TypeScript

import { redirect } from '@sveltejs/kit';
import { randomTrain } from '#lib/server/trains.js';
import type { RequestHandler } from './$types';
export const GET: RequestHandler = async ({ setHeaders }) => {
const train = await randomTrain();
setHeaders({ 'cache-control': 'no-store' });
redirect(303, train ? `/trackers/trains/${train.makerSlug}/${train.slug}` : '/trackers/trains');
};