This commit is contained in:
@@ -15,7 +15,7 @@ import * as Yup from 'yup'
|
||||
import Textarea from '../../components/Textarea'
|
||||
import UploadBoxDraggble from '../../components/UploadBoxDraggble'
|
||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||
import { toast } from 'react-toastify'
|
||||
import { toast } from '../../components/Toast';
|
||||
import UpdateCategory from './components/UpdateCategory'
|
||||
const BlogCategory: FC = () => {
|
||||
|
||||
@@ -38,7 +38,7 @@ const BlogCategory: FC = () => {
|
||||
}),
|
||||
onSubmit: async (values) => {
|
||||
if (!file) {
|
||||
toast.error('فایل را انتخاب کنید')
|
||||
toast('فایل را انتخاب کنید', 'error')
|
||||
return
|
||||
}
|
||||
const formData = new FormData()
|
||||
@@ -51,7 +51,7 @@ const BlogCategory: FC = () => {
|
||||
|
||||
createBlogCategory.mutateAsync(values, {
|
||||
onSuccess: () => {
|
||||
toast.success('دسته بندی با موفقیت ثبت شد')
|
||||
toast('دسته بندی با موفقیت ثبت شد', 'success')
|
||||
setFile(undefined)
|
||||
formik.resetForm()
|
||||
getBlogCategories.refetch()
|
||||
@@ -106,7 +106,7 @@ const BlogCategory: FC = () => {
|
||||
<Trash size={20} color='red' onClick={() => {
|
||||
deleteBlogCategory.mutateAsync(item.id, {
|
||||
onSuccess: () => {
|
||||
toast.success('دسته بندی با موفقیت حذف شد')
|
||||
toast('دسته بندی با موفقیت حذف شد', 'success')
|
||||
getBlogCategories.refetch()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -6,7 +6,7 @@ import { BlogCommentType } from './types/BlogTypes'
|
||||
import moment from 'moment-jalaali'
|
||||
import { CloseCircle, TickCircle } from 'iconsax-react'
|
||||
import { ErrorType } from '../../helpers/types'
|
||||
import { toast } from 'react-toastify'
|
||||
import { toast } from '../../components/Toast';
|
||||
const Comments: FC = () => {
|
||||
const { t } = useTranslation('global')
|
||||
const getBlogComments = useGetBlogComments()
|
||||
@@ -17,7 +17,7 @@ const Comments: FC = () => {
|
||||
getBlogComments.refetch()
|
||||
},
|
||||
onError: (error: ErrorType) => {
|
||||
toast.error(error.response?.data?.error.message[0])
|
||||
toast(error.response?.data?.error.message[0], 'error')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import CheckBoxComponent from '../../components/CheckBoxComponent'
|
||||
import UploadBoxDraggble from '../../components/UploadBoxDraggble'
|
||||
import QuillEditor from '../../components/QuillEditor'
|
||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||
import { toast } from 'react-toastify'
|
||||
import { toast } from '../../components/Toast';
|
||||
import { ErrorType } from '../../helpers/types'
|
||||
import { Pages } from '../../config/Pages'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
@@ -57,7 +57,7 @@ const CreateBlog: FC = () => {
|
||||
}),
|
||||
onSubmit: async (values) => {
|
||||
if (!file) {
|
||||
toast.error(t('errors.required'))
|
||||
toast(t('errors.required'), 'error')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -88,11 +88,11 @@ const CreateBlog: FC = () => {
|
||||
createBlog.mutate(values, {
|
||||
onSuccess() {
|
||||
setIsSaved(true)
|
||||
toast.success(t('success'))
|
||||
toast(t('success'), 'success')
|
||||
navigate(Pages.blog.list)
|
||||
},
|
||||
onError(error: ErrorType) {
|
||||
toast.error(error.response?.data?.error.message[0])
|
||||
toast(error.response?.data?.error.message[0], 'error')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -12,7 +12,7 @@ import CheckBoxComponent from '../../components/CheckBoxComponent'
|
||||
import UploadBoxDraggble from '../../components/UploadBoxDraggble'
|
||||
import QuillEditor from '../../components/QuillEditor'
|
||||
import { useSingleUpload } from '../service/hooks/useServiceData'
|
||||
import { toast } from 'react-toastify'
|
||||
import { toast } from '../../components/Toast';
|
||||
import { ErrorType } from '../../helpers/types'
|
||||
import { Pages } from '../../config/Pages'
|
||||
import { useNavigate, useParams } from 'react-router-dom'
|
||||
@@ -87,11 +87,11 @@ const UpdateBlog: FC = () => {
|
||||
updateBlog.mutate({ id: id || '', params: values }, {
|
||||
onSuccess() {
|
||||
setIsSaved(true)
|
||||
toast.success(t('success'))
|
||||
toast(t('success'), 'success')
|
||||
navigate(Pages.blog.list)
|
||||
},
|
||||
onError(error: ErrorType) {
|
||||
toast.error(error.response?.data?.error.message[0])
|
||||
toast(error.response?.data?.error.message[0], 'error')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@ import UploadBox from '../../../components/UploadBox'
|
||||
import { useSingleUpload } from '../../service/hooks/useServiceData'
|
||||
import SwitchComponent from '../../../components/Switch'
|
||||
import Button from '../../../components/Button'
|
||||
import { toast } from 'react-toastify'
|
||||
import { toast } from '../../../components/Toast';
|
||||
import { ErrorType } from '../../../helpers/types'
|
||||
interface Props {
|
||||
id: string
|
||||
@@ -42,12 +42,12 @@ const UpdateCategory: FC<Props> = ({ id }) => {
|
||||
}
|
||||
updateBlogCategory.mutateAsync({ id: id, params: values }, {
|
||||
onSuccess: () => {
|
||||
toast.success('دسته بندی با موفقیت ویرایش شد')
|
||||
toast('دسته بندی با موفقیت ویرایش شد', 'success')
|
||||
setIsOpen(false)
|
||||
window.location.reload()
|
||||
},
|
||||
onError: (error: ErrorType) => {
|
||||
toast.error(error.response?.data?.error.message[0])
|
||||
toast(error.response?.data?.error.message[0], 'error')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user