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
+7 -7
View File
@@ -8,7 +8,7 @@ import DatePickerComponent from '../../components/DatePicker'
import { useGetProfile, useUpdateProfile } from './hooks/useProfileData'
import Username from './components/Username'
import { useDropzone } from 'react-dropzone'
import { toast } from 'react-toastify'
import { toast } from '../../components/Toast'
import { useSingleUpload } from '../ticket/hooks/useTicketData'
import { ErrorType } from '../../helpers/types'
import { UpdateProfileType } from './types/ProfileTypes'
@@ -43,10 +43,10 @@ const Profile: FC = () => {
onSubmit: (values) => {
updateProfile.mutate(values, {
onSuccess: () => {
toast.success(t('success'))
toast(t('success'), 'success')
},
onError: (error: ErrorType) => {
toast.error(error.response?.data?.error?.message[0])
toast(error.response?.data?.error?.message[0], 'error')
}
})
}
@@ -82,19 +82,19 @@ const Profile: FC = () => {
}
updateProfile.mutate(params, {
onSuccess: () => {
toast.success(t('profile.image_uploaded_successfully'))
toast(t('profile.image_uploaded_successfully'), 'success')
},
onError: (error: ErrorType) => {
toast.error(error.response?.data?.error?.message[0])
toast(error.response?.data?.error?.message[0], 'error')
}
})
},
onError: (error: ErrorType) => {
toast.error(error.response?.data?.error?.message[0])
toast(error.response?.data?.error?.message[0], 'error')
}
})
} else {
toast.error(t('errors.is_not_image'))
toast(t('errors.is_not_image'), 'error')
}
}