Fix locale fetch (#1017)
This commit is contained in:
parent
71589721ef
commit
7c304702d6
1 changed files with 29 additions and 24 deletions
|
@ -418,8 +418,12 @@ function App(props: Props) {
|
||||||
document.head.appendChild(secondScript);
|
document.head.appendChild(secondScript);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const shouldFetchLanguage = !localeLangs && !localeSwitchDismissed;
|
||||||
|
const shouldFetchGdpr = gdprRequired === null || gdprRequired === undefined;
|
||||||
|
|
||||||
|
if (shouldFetchLanguage || shouldFetchGdpr) {
|
||||||
fetchLocaleApi().then((response) => {
|
fetchLocaleApi().then((response) => {
|
||||||
if (!localeLangs && !localeSwitchDismissed) {
|
if (shouldFetchLanguage) {
|
||||||
const countryCode = response?.data?.country;
|
const countryCode = response?.data?.country;
|
||||||
const langs = getLanguagesForCountry(countryCode);
|
const langs = getLanguagesForCountry(countryCode);
|
||||||
|
|
||||||
|
@ -430,7 +434,7 @@ function App(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// haven't done a gdpr check, do it now
|
// haven't done a gdpr check, do it now
|
||||||
if (gdprRequired === null || gdprRequired === undefined) {
|
if (shouldFetchGdpr) {
|
||||||
const gdprRequiredBasedOnLocation = response?.data?.gdpr_required;
|
const gdprRequiredBasedOnLocation = response?.data?.gdpr_required;
|
||||||
|
|
||||||
// note we need gdpr and load script
|
// note we need gdpr and load script
|
||||||
|
@ -446,6 +450,7 @@ function App(props: Props) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue