fix create review
This commit is contained in:
@@ -8,7 +8,7 @@ import { useFormik } from 'formik'
|
||||
import { CreateReviewType } from '../types/ServiecTypes'
|
||||
import * as Yup from 'yup'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import { useCreateReview } from '../hooks/useServiceData'
|
||||
import { useCreateReview, useGetServiceBySlug } from '../hooks/useServiceData'
|
||||
import { ErrorType } from '../../../helpers/types'
|
||||
import { toast } from '../../../components/Toast'
|
||||
import Error from '../../../components/Error'
|
||||
@@ -19,8 +19,10 @@ type Props = {
|
||||
|
||||
const CreateReview: FC<Props> = ({ refetch }) => {
|
||||
|
||||
const { id } = useParams()
|
||||
const { t } = useTranslation('global')
|
||||
const { id } = useParams()
|
||||
const getDetailService = useGetServiceBySlug(id ? id : '')
|
||||
|
||||
|
||||
const createReview = useCreateReview()
|
||||
|
||||
@@ -29,7 +31,7 @@ const CreateReview: FC<Props> = ({ refetch }) => {
|
||||
title: '',
|
||||
comment: '',
|
||||
rating: undefined,
|
||||
id: id ? id : ''
|
||||
id: getDetailService.data?.data?.danakService?.id
|
||||
},
|
||||
validationSchema: Yup.object({
|
||||
title: Yup.string().required(t('errors.required')),
|
||||
|
||||
Reference in New Issue
Block a user