Skip to content

Commit

Permalink
fix: prevent infinite reload in setlanguage interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisPannekeet committed May 2, 2024
1 parent e226f1c commit 10fc4a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/interactions/setLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ function setLanguage({ event }: { event: Event }): void {
const BBLocaleIndex = currentCookies.indexOf(`BBLocale=${locale}`);
const hasCookie = BBLocaleIndex > -1;
if (!hasCookie) {
document.cookie = `BBLocale=${locale};path=/`;
// check if app is used in an iFrame
if (window.location !== window.parent.location) {
document.cookie = `BBLocale=${locale};path=/;SameSite=None;Secure`;
} else {
document.cookie = `BBLocale=${locale};path=/`;
}
window.location.reload();
}
}

0 comments on commit 10fc4a1

Please sign in to comment.