Skip to content

Commit

Permalink
web: wrap error handler in onMount
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbmoron committed Sep 3, 2024
1 parent 93f8c03 commit f009da7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions web/src/routes/+error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
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 });
} else {
goto("/", { replaceState: true });
}
}
}
});
</script>

0 comments on commit f009da7

Please sign in to comment.