This commit is contained in:
hamid zarghami
2025-05-03 11:58:06 +03:30
parent 9a2ea35918
commit 551dfa0a56
20 changed files with 124 additions and 66 deletions
+4 -5
View File
@@ -11,10 +11,9 @@ import { Link } from 'react-router-dom'
import { Pages } from '../../../config/Pages'
import { isEmail } from '../../../config/func'
import { useCheckHasAccount, useLoginWithOtp } from '../hooks/useAuthData'
import { toast } from 'react-toastify'
import { ErrorType } from '../../../helpers/types'
import { ArrowLeft } from 'iconsax-react'
import { toast } from '../../../components/Toast'
const LoginStep1: FC = () => {
const { t } = useTranslation('global')
@@ -38,7 +37,7 @@ const LoginStep1: FC = () => {
setStepLogin(2)
},
onError(error: ErrorType) {
toast.error(error?.response?.data?.error?.message[0])
toast(error.response?.data?.error.message?.[0], 'error')
},
})
} else {
@@ -46,10 +45,10 @@ const LoginStep1: FC = () => {
loginWithOtp.mutate({ phone: values.phone_email }, {
onSuccess() {
setStepLogin(2)
toast.success(t('auth.otp_sent'))
toast(t('auth.otp_sent'), 'success')
},
onError(error: ErrorType) {
toast.error(error?.response?.data?.error?.message[0])
toast(error?.response?.data?.error?.message[0], 'error')
},
})
}
+4 -4
View File
@@ -11,10 +11,10 @@ import { useCountDown } from '../../../hooks/useCountDown'
import { Pages } from '../../../config/Pages'
import { useLoginWithOtp, useOtpVerify } from '../hooks/useAuthData'
import { ErrorType } from '../../../helpers/types'
import { toast } from 'react-toastify'
import { setRefreshToken } from '../../../config/func'
import { setToken } from '../../../config/func'
import { getRedirectUrl } from '../../../config/func'
import { toast } from '../../../components/Toast'
const LoginStep2: FC = () => {
const { t } = useTranslation('global')
@@ -50,7 +50,7 @@ const LoginStep2: FC = () => {
window.location.href = Pages.dashboard
},
onError(error: ErrorType) {
toast.error(error?.response?.data?.error?.message[0])
toast(error?.response?.data?.error?.message[0], 'error')
},
})
},
@@ -81,10 +81,10 @@ const LoginStep2: FC = () => {
loginWithOtp.mutate({ phone: phone }, {
onSuccess: () => {
reset()
toast.success(t('auth.toast_resend_code'))
toast(t('auth.toast_resend_code'), 'success')
},
onError: (error: ErrorType) => {
toast.error(error.response?.data?.error.message[0])
toast(error.response?.data?.error.message[0], 'error')
}
})
}
+2 -2
View File
@@ -11,7 +11,7 @@ import { Link } from 'react-router-dom'
import { Pages } from '../../../config/Pages'
import ArrowLeftIcon from '../../../assets/images/arrow-left.svg'
import { useLoginWithPassword } from '../hooks/useAuthData'
import { toast } from 'react-toastify'
import { toast } from '../../../components/Toast'
import { ErrorType } from '../../../helpers/types'
import { setRefreshToken } from '../../../config/func'
import { setToken } from '../../../config/func'
@@ -46,7 +46,7 @@ const LoginStep3: FC = () => {
window.location.href = Pages.dashboard
},
onError(error: ErrorType) {
toast.error(error?.response?.data?.error?.message[0])
toast(error?.response?.data?.error?.message[0], 'error')
},
})