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