web/settings: redirect invalid settings paths to default settings page
This commit is contained in:
17
web/src/routes/+error.svelte
Normal file
17
web/src/routes/+error.svelte
Normal file
@@ -0,0 +1,17 @@
|
||||
<script lang="ts">
|
||||
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 });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- TODO: nicer errors -->
|
||||
<h1>{$page.status}: {$page.error?.message}</h1>
|
||||
Reference in New Issue
Block a user