fix: auto zero remove aded to phone number input
This commit is contained in:
@@ -67,6 +67,15 @@ export const CompleteSignUp = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
let newValue = e.target.value;
|
||||||
|
if (newValue.startsWith('09')) {
|
||||||
|
newValue = newValue.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
setValue(newValue);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AuthenticationCard>
|
<AuthenticationCard>
|
||||||
<Typography variant="h5" sx={{ mb: 0.5 }}>
|
<Typography variant="h5" sx={{ mb: 0.5 }}>
|
||||||
@@ -85,7 +94,7 @@ export const CompleteSignUp = ({
|
|||||||
inputRef={inputRef}
|
inputRef={inputRef}
|
||||||
label={t('completeSignUp.phoneNumber')}
|
label={t('completeSignUp.phoneNumber')}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => setValue(e.target.value)}
|
onChange={handleChange}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
error={inputError}
|
error={inputError}
|
||||||
helperText={inputError ? error : ''}
|
helperText={inputError ? error : ''}
|
||||||
|
|||||||
@@ -53,7 +53,11 @@ export function LoginRegisterForm({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const newValue = event.target.value;
|
let newValue = event.target.value;
|
||||||
|
if (newValue.startsWith('09')) {
|
||||||
|
newValue = newValue.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
setLoginRegisterValue(newValue);
|
setLoginRegisterValue(newValue);
|
||||||
|
|
||||||
// If the new value contains only digits (or is empty), it's a phone number
|
// If the new value contains only digits (or is empty), it's a phone number
|
||||||
|
|||||||
Reference in New Issue
Block a user