fix: farsi digits and autofoucs in digits input
This commit is contained in:
@@ -67,9 +67,6 @@ export function LoginRegisterForm({
|
||||
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
let newValue = event.target.value;
|
||||
newValue = replacePersianWithRealNumbers(newValue);
|
||||
if (newValue.startsWith('09')) {
|
||||
newValue = newValue.substring(1);
|
||||
}
|
||||
|
||||
setLoginRegisterValue(newValue);
|
||||
|
||||
@@ -112,10 +109,20 @@ export function LoginRegisterForm({
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (validateInput(loginRegisterValue, authType, false)) {
|
||||
let newValue = loginRegisterValue;
|
||||
|
||||
if (
|
||||
authType === 'phone' &&
|
||||
countryCode === '+98' &&
|
||||
newValue.startsWith('09')
|
||||
) {
|
||||
newValue = newValue.substring(1);
|
||||
setLoginRegisterValue(newValue);
|
||||
}
|
||||
|
||||
const res = await execUserStatus({
|
||||
phoneNumber:
|
||||
authType === 'phone' ? countryCode + loginRegisterValue : undefined,
|
||||
email: authType === 'email' ? loginRegisterValue : undefined,
|
||||
phoneNumber: authType === 'phone' ? countryCode + newValue : undefined,
|
||||
email: authType === 'email' ? newValue : undefined,
|
||||
});
|
||||
|
||||
if (!res) {
|
||||
@@ -123,7 +130,7 @@ export function LoginRegisterForm({
|
||||
}
|
||||
|
||||
if (res.success) {
|
||||
onLoginRegisterSubmit(loginRegisterValue, res.userStatus);
|
||||
onLoginRegisterSubmit(newValue, res.userStatus);
|
||||
} else {
|
||||
toast({ message: res.message, severity: 'error' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user