File size: 651 Bytes
43a06dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<script lang="ts">
    import { onMount } from "svelte";
    import { page } from "$app/stores";
    import { goto } from "$app/navigation";
    import { defaultNavPage } from "$lib/subnav";

    onMount(() => {
        if ($page.error?.message === "Not Found") {
            if ($page.url.pathname.startsWith("/settings")) {
                goto(defaultNavPage("settings"), { replaceState: true });
            } else if ($page.url.pathname.startsWith("/about")) {
                goto(defaultNavPage("about"), { replaceState: true });
            } else {
                goto("/", { replaceState: true });
            }
        }
    });
</script>