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