aboutsummaryrefslogtreecommitdiff
path: root/asset-sources
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2024-04-06 22:23:53 +0200
committerDaniel Schadt <kingdread@gmx.de>2024-04-06 22:23:53 +0200
commit7400bdda03eedf76209badf45508eddf93207149 (patch)
treec20e13b44dcc89731567cc5e9cc717d06bc849ca /asset-sources
parent4f96b9c3f39213a5f6ae631c7c820f63fc2219d5 (diff)
downloadfietsboek-7400bdda03eedf76209badf45508eddf93207149.tar.gz
fietsboek-7400bdda03eedf76209badf45508eddf93207149.tar.bz2
fietsboek-7400bdda03eedf76209badf45508eddf93207149.zip
fix language only being chosen for subsites
Turns out that the default Path= value for cookies is not what we want, so we set it explicitely.
Diffstat (limited to 'asset-sources')
-rw-r--r--asset-sources/fietsboek.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/asset-sources/fietsboek.ts b/asset-sources/fietsboek.ts
index 1073ae4..d9d2c15 100644
--- a/asset-sources/fietsboek.ts
+++ b/asset-sources/fietsboek.ts
@@ -1,4 +1,5 @@
declare const FRIENDS_URL: string;
+declare const BASE_URL: string;
declare const LOCALE: string;
/**
@@ -57,8 +58,9 @@ function addHandler<K extends keyof GlobalEventHandlersEventMap>(
* @param event - The triggering event.
*/
function languageClicked(event: MouseEvent) {
+ const path = new URL(BASE_URL).pathname;
const language = (event.target as HTMLElement).getAttribute("data-langcode");
- document.cookie = "fietsboek_locale=" + language;
+ document.cookie = `fietsboek_locale=${language}; Path=${path}`;
window.location.reload();
event.preventDefault();
}