All checks were successful
Deploy production / deploy (push) Successful in 1m9s
10 lines
390 B
TypeScript
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');
|
|
};
|