mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 23:53:25 +00:00
fix embedding redirect
This commit is contained in:
@@ -11,6 +11,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 { getURLForLanguage } from '$lib/utils';
|
||||||
|
|
||||||
const appRoutes = ['/[[language]]/app', '/[[language]]/embed'];
|
const appRoutes = ['/[[language]]/app', '/[[language]]/embed'];
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
if ($page.url.searchParams.has('embed')) {
|
if ($page.url.searchParams.has('embed')) {
|
||||||
// convert old embedding options to new format and redirect to new embed page
|
// convert old embedding options to new format and redirect to new embed page
|
||||||
let locale = $page.url.pathname.split('/')[1] ?? 'en';
|
let locale = $page.url.pathname.split('/')[1] ?? 'en';
|
||||||
window.location.href = `${base}${locale ? '/' + locale : ''}/embed?options=${encodeURIComponent(JSON.stringify(convertOldEmbeddingOptions($page.url.searchParams)))}`;
|
window.location.href = `${getURLForLanguage(locale, '/embed')}?options=${encodeURIComponent(JSON.stringify(convertOldEmbeddingOptions($page.url.searchParams)))}`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user