spotters: fix random 404 on client navigation (random is a page load, not an endpoint shadowed by [slug]); square logo tiles everywhere
Some checks failed
Deploy production / deploy (push) Has been cancelled

This commit is contained in:
2026-10-25 13:07:26 +00:00
parent 45943543c2
commit cc34f5751b
19 changed files with 69 additions and 138 deletions

View File

@@ -0,0 +1,11 @@
import { redirect } from '@sveltejs/kit';
import { randomCar } from '#lib/server/cars.js';
import type { PageServerLoad } from './$types';
// A page load (not a +server.ts endpoint): the client router only knows page routes, so an
// endpoint here made client-side navigation fall through to the [brand] page and 404.
export const load: PageServerLoad = async ({ setHeaders }) => {
const car = await randomCar();
setHeaders({ 'cache-control': 'no-store' });
redirect(303, car ? `/trackers/cars/${car.brandSlug}/${car.slug}` : '/trackers/cars');
};