import { FC } from 'react' import { useTranslation } from 'react-i18next' import Td from '../../components/Td' import { useChangeStatusComment, useGetBlogComments } from './hooks/useBlogData' import { BlogCommentType } from './types/BlogTypes' import moment from 'moment-jalaali' import { CloseCircle, TickCircle } from 'iconsax-react' import { ErrorType } from '../../helpers/types' import { toast } from '../../components/Toast'; import { usePermissions } from '../../hooks/usePermissions' const Comments: FC = () => { const { t } = useTranslation('global') const { canUpdate } = usePermissions() const getBlogComments = useGetBlogComments() const changeStatusComment = useChangeStatusComment() const handleChangeStatus = (id: string, status: string) => { changeStatusComment.mutate({ id, status }, { onSuccess: () => { getBlogComments.refetch() }, onError: (error: ErrorType) => { toast(error.response?.data?.error.message[0], 'error') } }) } return (
|
{
item.status === 'PENDING' && canUpdate('blog_comments') &&
|