use base in 404 redirect

This commit is contained in:
vcoppe
2024-07-26 00:12:36 +02:00
parent cbb6920ebf
commit a3f692f969
2 changed files with 4 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
<script lang="ts">
import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import { _, locale } from 'svelte-i18n';
export let path: string;
@@ -22,7 +23,7 @@
if (modules.hasOwnProperty(`/src/lib/docs/${$locale}/${path}`)) {
loadModule(`/src/lib/docs/${$locale}/${path}`);
} else if (browser) {
goto(`/404`);
goto(`${base}/404`);
}
}
</script>

View File

@@ -9,6 +9,7 @@
import { languages } from '$lib/languages';
import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { base } from '$app/paths';
$: if ($page.params.language === '' && $locale !== 'en') {
locale.set('en');
@@ -18,7 +19,7 @@
if (languages.hasOwnProperty(lang)) {
locale.set(lang);
} else if (browser) {
goto('/404');
goto(`${base}/404`);
}
}
}