fix problem show toast

This commit is contained in:
hamid zarghami
2025-05-20 15:36:31 +03:30
parent 7f862c2ca5
commit 35979729d3
6 changed files with 19 additions and 19 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ import { useAuthStore } from '../store/AuthStore'
import Error from '../../../components/Error'
import Button from '../../../components/Button'
import { useCheckHasAccountRegister, useLoginWithOtp } from '../hooks/useAuthData'
import { toast } from 'react-toastify'
import { toast } from '../../../components/Toast'
import { ErrorType } from '../../../helpers/types'
const RegisterStep1: FC = () => {
@@ -33,7 +33,7 @@ const RegisterStep1: FC = () => {
setStepLogin(2)
},
onError(error: ErrorType) {
toast.error(error?.response?.data?.error?.message[0])
toast(error?.response?.data?.error?.message[0], 'error')
},
})
},
+2 -2
View File
@@ -9,11 +9,11 @@ import DatePickerComponent from '../../../components/DatePicker'
import Button from '../../../components/Button'
import { useRegister } from '../hooks/useAuthData'
import { ErrorType } from '../../../helpers/types'
import { toast } from 'react-toastify'
import { Pages } from '../../../config/Pages'
import { setToken } from '../../../config/func'
import { setRefreshToken } from '../../../config/func'
import { getRedirectUrl } from '../../../config/func'
import { toast } from '../../../components/Toast'
const RegisterStep2: FC = () => {
const { t } = useTranslation('global')
@@ -59,7 +59,7 @@ const RegisterStep2: 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')
},
})
},
+3 -3
View File
@@ -10,7 +10,7 @@ import * as Yup from 'yup'
import { useCreateLegalUser, useGetCities, useGetLegalInfo, useGetProvines } from '../hooks/useFinancialData'
import Select from '../../../components/Select'
import PageLoading from '../../../components/PageLoading'
import { toast } from 'react-toastify'
import { toast } from '../../../components/Toast'
import { ErrorType } from '../../../helpers/types'
import { useGetProfile } from '../../profile/hooks/useProfileData'
@@ -53,11 +53,11 @@ const Legal: FC = () => {
}
createLegalUser.mutate(params, {
onSuccess: () => {
toast.success(t('success'))
toast(t('success'), 'success')
window.location.reload()
},
onError(error: ErrorType) {
toast.error(error.response?.data?.error.message[0])
toast(error.response?.data?.error.message[0], 'error')
},
})
}
+3 -3
View File
@@ -9,7 +9,7 @@ import { InfoCircle, TickCircle } from 'iconsax-react'
import { CreateRealUserType, ProvinesItemType } from '../types/FinancialTypes'
import * as Yup from 'yup'
import { useCreateRealUser, useGetCities, useGetProvines, useGetRealInfo } from '../hooks/useFinancialData'
import { toast } from 'react-toastify'
import { toast } from '../../../components/Toast'
import { ErrorType } from '../../../helpers/types'
import DatePickerComponent from '../../../components/DatePicker'
import { useGetProfile } from '../../profile/hooks/useProfileData'
@@ -60,11 +60,11 @@ const Personal: FC = () => {
}
createRealUser.mutate(params, {
onSuccess: () => {
toast.success(t('success'))
toast(t('success'), 'success')
window.location.reload()
},
onError(error: ErrorType) {
toast.error(error.response?.data?.error.message[0])
toast(error.response?.data?.error.message[0], 'error')
},
})
}
+5 -5
View File
@@ -16,7 +16,7 @@ import PayInvoice from './components/PayInvoice'
import Input from '../../components/Input'
import { Helmet } from 'react-helmet-async'
import { useGetProfile } from '../profile/hooks/useProfileData'
import { toast } from 'react-toastify'
import { toast } from '../../components/Toast'
import { ErrorType } from '../../helpers/types'
import PDFGenerator from '../../components/PDFGenerator'
import { useGetGetWays } from '../wallet/hooks/useWalletData'
@@ -41,11 +41,11 @@ const ReceiptsDetail: FC = () => {
}
applyDiscount.mutate(params, {
onSuccess: () => {
toast.success(t('receip.discount_applied'))
toast(t('receip.discount_applied'), 'success')
getInvoce.refetch()
},
onError: (error: ErrorType) => {
toast.error(error?.response?.data?.error?.message[0])
toast(error?.response?.data?.error?.message[0], 'error')
}
})
}
@@ -53,11 +53,11 @@ const ReceiptsDetail: FC = () => {
const handleRemoveDiscount = () => {
removeDiscount.mutate({ id: id ? id : '' }, {
onSuccess: () => {
toast.success(t('receip.discount_removed'))
toast(t('receip.discount_removed'), 'success')
getInvoce.refetch()
},
onError: (error: ErrorType) => {
toast.error(error?.response?.data?.error?.message[0])
toast(error?.response?.data?.error?.message[0], 'error')
}
})
}
@@ -4,7 +4,7 @@ import { TickCircle } from 'iconsax-react'
import { useTranslation } from 'react-i18next'
import { useApproveInvoice, useRequestApprove } from '../hooks/useReceiptData'
import { ErrorType } from '../../../helpers/types'
import { toast } from 'react-toastify'
import { toast } from '../../../components/Toast'
import { clx } from '../../../helpers/utils'
import { useGetProfile } from '../../profile/hooks/useProfileData'
import { RequestApproveInvoiceType } from '../types/ReceiptTypes'
@@ -31,12 +31,12 @@ const ApproveInvoice: FC<Props> = ({ id, refetch, status }) => {
const handleConfrim = () => {
approveInvoce.mutate({ code: code, id: id, phone: getProfile.data?.data?.user?.phone }, {
onSuccess: () => {
toast.success(t('success'))
toast(t('success'), 'success')
refetch()
setShowModal(false)
},
onError: (error: ErrorType) => {
toast.error(error.response?.data?.error.message[0])
toast(error.response?.data?.error.message[0], 'error')
}
})
}
@@ -52,7 +52,7 @@ const ApproveInvoice: FC<Props> = ({ id, refetch, status }) => {
reset()
},
onError: (error: ErrorType) => {
toast.error(error.response?.data?.error.message[0])
toast(error.response?.data?.error.message[0], 'error')
}
})
}