Render unknown URLs inside the app shell and move ListeningStats to the domain types
Add catch-all routes so unknown pages 404 inside the (app) layout and unknown /api URLs return a JSON 404 instead of redirecting to the login page. Restore the full root error page.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { error } from '@sveltejs/kit';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
export const load: PageServerLoad = () => {
|
||||
error(404, 'Página no encontrada');
|
||||
};
|
||||
@@ -1,12 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
import Button from '$lib/components/ui/primitives/Button.svelte';
|
||||
</script>
|
||||
|
||||
<div class="min-h-screen bg-bg text-fg antialiased">
|
||||
<div class="mx-auto my-[14vh] max-w-prose-sm text-center">
|
||||
<div class="min-h-screen bg-bg px-6 text-fg antialiased">
|
||||
<div class="animate-enter mx-auto my-[14vh] max-w-prose-sm text-center">
|
||||
<h1 class="mb-2.5 text-display-3">
|
||||
{page.status === 404 ? 'Página no encontrada' : 'Algo salió mal'}
|
||||
</h1>
|
||||
<a href="/" class="text-body text-fg-2 underline">Volver al inicio</a>
|
||||
<p class="mb-6.5 text-body text-fg-2">
|
||||
{page.status === 404
|
||||
? 'Comprueba el enlace o vuelve al inicio.'
|
||||
: 'No se pudo cargar la página. Inténtalo de nuevo en unos momentos.'}
|
||||
</p>
|
||||
<Button href="/" variant="secondary">Volver al inicio</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
export const fallback: RequestHandler = () => json({ message: 'No encontrado.' }, { status: 404 });
|
||||
Reference in New Issue
Block a user