mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-28 18:46:09 +00:00
web/error: redirect home on 404
This commit is contained in:
parent
95bcf7bf66
commit
6c7695ca6c
|
@ -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