mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 23:53:25 +00:00
use base in 404 redirect
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
import { base } from '$app/paths';
|
||||||
import { _, locale } from 'svelte-i18n';
|
import { _, locale } from 'svelte-i18n';
|
||||||
|
|
||||||
export let path: string;
|
export let path: string;
|
||||||
@@ -22,7 +23,7 @@
|
|||||||
if (modules.hasOwnProperty(`/src/lib/docs/${$locale}/${path}`)) {
|
if (modules.hasOwnProperty(`/src/lib/docs/${$locale}/${path}`)) {
|
||||||
loadModule(`/src/lib/docs/${$locale}/${path}`);
|
loadModule(`/src/lib/docs/${$locale}/${path}`);
|
||||||
} else if (browser) {
|
} else if (browser) {
|
||||||
goto(`/404`);
|
goto(`${base}/404`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
import { languages } from '$lib/languages';
|
import { languages } from '$lib/languages';
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
import { base } from '$app/paths';
|
||||||
|
|
||||||
$: if ($page.params.language === '' && $locale !== 'en') {
|
$: if ($page.params.language === '' && $locale !== 'en') {
|
||||||
locale.set('en');
|
locale.set('en');
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
if (languages.hasOwnProperty(lang)) {
|
if (languages.hasOwnProperty(lang)) {
|
||||||
locale.set(lang);
|
locale.set(lang);
|
||||||
} else if (browser) {
|
} else if (browser) {
|
||||||
goto('/404');
|
goto(`${base}/404`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user