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 { 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";
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
$: {
|
onMount(() => {
|
||||||
if ($page.error?.message === "Not Found") {
|
if ($page.error?.message === "Not Found") {
|
||||||
if ($page.url.pathname.startsWith("/settings")) {
|
if ($page.url.pathname.startsWith("/settings")) {
|
||||||
goto(defaultSettingsPage(), { replaceState: true });
|
goto(defaultSettingsPage(), { replaceState: true });
|
||||||
|
@ -11,5 +12,5 @@
|
||||||
goto("/", { replaceState: true });
|
goto("/", { replaceState: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue