refactor: Use $app/state instead of $app/stores in error page
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
c9cfaa10e7
commit
337e9f86ac
@@ -1,21 +1,21 @@
|
||||
<script>
|
||||
import { goto } from '$app/navigation';
|
||||
import { resolve } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { page } from '$app/state';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// Only redirect if it's a 404 error
|
||||
onMount(() => {
|
||||
if ($page.status === 404) {
|
||||
if (page.status === 404) {
|
||||
goto(resolve('/'));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if $page.status !== 404}
|
||||
{#if page.status !== 404}
|
||||
<div class="container mx-auto p-8">
|
||||
<h1 class="mb-4 text-2xl font-bold">Error {$page.status}</h1>
|
||||
<p class="mb-4">{$page.error?.message || 'An unexpected error occurred'}</p>
|
||||
<h1 class="mb-4 text-2xl font-bold">Error {page.status}</h1>
|
||||
<p class="mb-4">{page.error?.message || 'An unexpected error occurred'}</p>
|
||||
<a href={resolve('/')} class="text-blue-500 hover:underline">Return to Home</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user