Merge pull request 'fix(auth): clear mobile number field automatically when country changes during registration' (#90) from fix/clear-phone-on-country-change into main
Reviewed-on: https://git.zedobject.local/AcuPedia/acupedia-store-ui/pulls/90 Reviewed-by: Amit Salunke <amit@noreply.localhost>
This commit is contained in:
commit
f46d9cdc8d
|
|
@ -294,11 +294,13 @@ export const AuthModal: React.FC<AuthModalProps> = ({
|
||||||
value={authDialCode}
|
value={authDialCode}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const newCode = e.target.value;
|
const newCode = e.target.value;
|
||||||
setAuthDialCode(newCode);
|
if (newCode !== authDialCode) {
|
||||||
const rule = getCountryRuleByDialCode(newCode);
|
setAuthDialCode(newCode);
|
||||||
if (rule && rule.country !== 'Other') {
|
const rule = getCountryRuleByDialCode(newCode);
|
||||||
setAuthCountry(rule.country);
|
if (rule && rule.country !== 'Other') {
|
||||||
setAuthPhone(cleanPhoneInput(authPhone, rule.maxLength, false));
|
setAuthCountry(rule.country);
|
||||||
|
}
|
||||||
|
setAuthPhone('');
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className="w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-2.5 text-xs sm:text-sm font-semibold text-white focus:outline-none focus:border-indigo-500 appearance-none pr-6"
|
className="w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-2.5 text-xs sm:text-sm font-semibold text-white focus:outline-none focus:border-indigo-500 appearance-none pr-6"
|
||||||
|
|
@ -341,11 +343,13 @@ export const AuthModal: React.FC<AuthModalProps> = ({
|
||||||
value={authCountry}
|
value={authCountry}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const newCountry = e.target.value;
|
const newCountry = e.target.value;
|
||||||
setAuthCountry(newCountry);
|
if (newCountry !== authCountry) {
|
||||||
const rule = getCountryRuleByName(newCountry);
|
setAuthCountry(newCountry);
|
||||||
if (rule) {
|
const rule = getCountryRuleByName(newCountry);
|
||||||
setAuthDialCode(rule.code);
|
if (rule) {
|
||||||
setAuthPhone(cleanPhoneInput(authPhone, rule.maxLength, false));
|
setAuthDialCode(rule.code);
|
||||||
|
}
|
||||||
|
setAuthPhone('');
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className="w-full bg-slate-950 border border-slate-800 rounded-xl px-4 py-2.5 text-sm font-semibold text-white focus:outline-none focus:border-indigo-500 appearance-none"
|
className="w-full bg-slate-950 border border-slate-800 rounded-xl px-4 py-2.5 text-sm font-semibold text-white focus:outline-none focus:border-indigo-500 appearance-none"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue