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
|
@ -50,4 +50,4 @@ const defaultSettingsPage = () => {
|
|||
}
|
||||
|
||||
export default defaultSettings;
|
||||
export { defaultSettingsPage };
|
||||
export { defaultSettingsPage };
|
||||
|
|
|
@ -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')
|
||||
) {
|
||||
goto(defaultSettingsPage(), { replaceState: true });
|
||||
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