fix(checkout): validate and display duplicate mobile number errors in billing phone modal
This commit is contained in:
parent
7a2d966796
commit
36a530b8d7
|
|
@ -438,8 +438,9 @@ export default function App() {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
alert(err.response?.data?.detail || 'Failed to save billing phone number.');
|
const errorMsg = err.response?.data?.detail || 'Failed to save billing phone number.';
|
||||||
return false;
|
alert(errorMsg);
|
||||||
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,11 +54,16 @@ export const BillingPhoneModal: React.FC<BillingPhoneModalProps> = ({
|
||||||
|
|
||||||
setSaving(true);
|
setSaving(true);
|
||||||
const e164 = formatE164Phone(dialCode, phone);
|
const e164 = formatE164Phone(dialCode, phone);
|
||||||
|
try {
|
||||||
const success = await onSavePhone(e164, country);
|
const success = await onSavePhone(e164, country);
|
||||||
setSaving(false);
|
|
||||||
if (success) {
|
if (success) {
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
|
} catch (err: any) {
|
||||||
|
setError(err?.message || 'Failed to save billing phone number.');
|
||||||
|
} finally {
|
||||||
|
setSaving(false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue