fix create review

This commit is contained in:
hamid zarghami
2025-08-31 12:44:24 +03:30
parent 87c5908177
commit da4fae2c0e
@@ -8,7 +8,7 @@ import { useFormik } from 'formik'
import { CreateReviewType } from '../types/ServiecTypes' import { CreateReviewType } from '../types/ServiecTypes'
import * as Yup from 'yup' import * as Yup from 'yup'
import { useParams } from 'react-router-dom' import { useParams } from 'react-router-dom'
import { useCreateReview } from '../hooks/useServiceData' import { useCreateReview, useGetServiceBySlug } from '../hooks/useServiceData'
import { ErrorType } from '../../../helpers/types' import { ErrorType } from '../../../helpers/types'
import { toast } from '../../../components/Toast' import { toast } from '../../../components/Toast'
import Error from '../../../components/Error' import Error from '../../../components/Error'
@@ -19,8 +19,10 @@ type Props = {
const CreateReview: FC<Props> = ({ refetch }) => { const CreateReview: FC<Props> = ({ refetch }) => {
const { id } = useParams()
const { t } = useTranslation('global') const { t } = useTranslation('global')
const { id } = useParams()
const getDetailService = useGetServiceBySlug(id ? id : '')
const createReview = useCreateReview() const createReview = useCreateReview()
@@ -29,7 +31,7 @@ const CreateReview: FC<Props> = ({ refetch }) => {
title: '', title: '',
comment: '', comment: '',
rating: undefined, rating: undefined,
id: id ? id : '' id: getDetailService.data?.data?.danakService?.id
}, },
validationSchema: Yup.object({ validationSchema: Yup.object({
title: Yup.string().required(t('errors.required')), title: Yup.string().required(t('errors.required')),