trains: pokedex pages (builders, operators, countries, detail, random) and registrations
All checks were successful
Deploy production / deploy (push) Successful in 1m9s
All checks were successful
Deploy production / deploy (push) Successful in 1m9s
This commit is contained in:
9
src/routes/trackers/trains/random/+server.ts
Normal file
9
src/routes/trackers/trains/random/+server.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
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');
|
||||
};
|
||||
Reference in New Issue
Block a user