mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
web/error: redirect home on 404
This commit is contained in:
parent
95bcf7bf66
commit
6c7695ca6c
2 changed files with 10 additions and 12 deletions
|
@ -1,17 +1,15 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from "$app/navigation";
|
||||||
import { page } from '$app/stores';
|
import { page } from "$app/stores";
|
||||||
import { defaultSettingsPage } from '$lib/settings/defaults';
|
import { defaultSettingsPage } from "$lib/settings/defaults";
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (
|
if ($page.error?.message === "Not Found") {
|
||||||
$page.error?.message === 'Not Found'
|
if ($page.url.pathname.startsWith("/settings")) {
|
||||||
&& $page.url.pathname.startsWith('/settings')
|
goto(defaultSettingsPage(), { replaceState: true });
|
||||||
) {
|
} else {
|
||||||
goto(defaultSettingsPage(), { replaceState: true });
|
goto("/", { replaceState: true });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- TODO: nicer errors -->
|
|
||||||
<h1>{$page.status}: {$page.error?.message}</h1>
|
|
Loading…
Reference in a new issue