save cookie by hostname instead of host, because cookies don't like

ports
This commit is contained in:
HF 2023-12-11 16:48:47 +01:00
parent 8544c42e7b
commit fe8541bcbf

View File

@ -66,14 +66,14 @@ function LanguageSelect() {
/* set with selected language */
const d = new Date();
d.setTime(d.getTime() + 24 * MONTH);
let { host } = window.location;
if (host.lastIndexOf('.') !== host.indexOf('.')) {
host = host.slice(host.indexOf('.'));
let { hostname } = window.location;
if (hostname.lastIndexOf('.') !== hostname.indexOf('.')) {
hostname = hostname.slice(hostname.indexOf('.'));
} else {
host = `.${host}`;
hostname = `.${hostname}`;
}
// eslint-disable-next-line max-len
document.cookie = `plang=${langSel};expires=${d.toUTCString()};path=/;domain=${host}`;
document.cookie = `plang=${langSel};expires=${d.toUTCString()};path=/;domain=${hostname}`;
window.location.reload();
}}
>