mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 04:39:58 +00:00
web: wrap error handler in onMount
This commit is contained in:
parent
93f8c038d2
commit
f009da7de4
1 changed files with 3 additions and 2 deletions
|
@ -2,8 +2,9 @@
|
|||
import { goto } from "$app/navigation";
|
||||
import { page } from "$app/stores";
|
||||
import { defaultSettingsPage } from "$lib/settings/defaults";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
$: {
|
||||
onMount(() => {
|
||||
if ($page.error?.message === "Not Found") {
|
||||
if ($page.url.pathname.startsWith("/settings")) {
|
||||
goto(defaultSettingsPage(), { replaceState: true });
|
||||
|
@ -11,5 +12,5 @@
|
|||
goto("/", { replaceState: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue