fix: ripple effect of skip_registeration_form if country not coming from ip (#838)

Co-authored-by: Syed Sajjad  Hussain Shah <syed.sajjad@H7FKF7K6XD.local>
This commit is contained in:
Syed Sajjad Hussain Shah
2023-04-10 12:41:03 +05:00
committed by GitHub
parent 9d487d7b61
commit c2bdc31a03

View File

@@ -190,21 +190,24 @@ const RegistrationPage = (props) => {
}, [registrationErrorCode]);
useEffect(() => {
if (backendCountryCode !== '') {
const selectedCountry = countryList.find(
(country) => (country[COUNTRY_CODE_KEY].toLowerCase() === backendCountryCode.toLowerCase()),
);
if (selectedCountry) {
setConfigurableFormFields(prevState => (
{
...prevState,
country: {
countryCode: selectedCountry[COUNTRY_CODE_KEY], displayValue: selectedCountry[COUNTRY_DISPLAY_KEY],
},
}
));
}
let countryCode = '';
let countryDisplayValue = '';
const selectedCountry = countryList.find(
(country) => (country[COUNTRY_CODE_KEY].toLowerCase() === backendCountryCode.toLowerCase()),
);
if (selectedCountry) {
countryCode = selectedCountry[COUNTRY_CODE_KEY];
countryDisplayValue = selectedCountry[COUNTRY_DISPLAY_KEY];
}
setConfigurableFormFields(prevState => (
{
...prevState,
country: {
countryCode, displayValue: countryDisplayValue,
},
}
));
}, [backendCountryCode, countryList]);
/**