fix type
This commit is contained in:
@@ -14,7 +14,7 @@ const PrintForm: FC = () => {
|
||||
|
||||
const navigate = useNavigate()
|
||||
const { itemId, orderId } = useParams()
|
||||
const { data: item } = useGetOrderItem(+itemId!)
|
||||
const { data: item } = useGetOrderItem(itemId!)
|
||||
const { isPending, mutate } = useCreatePrintForm()
|
||||
const { data } = useGetSections()
|
||||
|
||||
@@ -24,7 +24,7 @@ const PrintForm: FC = () => {
|
||||
printAttributes: []
|
||||
},
|
||||
onSubmit: (values) => {
|
||||
mutate({ itemId: +itemId!, orderId: orderId!, params: values }, {
|
||||
mutate({ itemId: itemId!, orderId: orderId!, params: values }, {
|
||||
onSuccess: () => {
|
||||
toast('با موفقیت ذخیره شد', 'success')
|
||||
navigate(-1)
|
||||
|
||||
@@ -20,7 +20,7 @@ const ManageForms: FC<Props> = (props) => {
|
||||
|
||||
const { attributes, formik } = props
|
||||
|
||||
const handleChange = (attributeId: number, value: string) => {
|
||||
const handleChange = (attributeId: string, value: string) => {
|
||||
const attribute = formik.values.printAttributes
|
||||
const index: number = attribute.findIndex(o => o.fieldId === attributeId)
|
||||
if (index > -1) {
|
||||
@@ -28,7 +28,7 @@ const ManageForms: FC<Props> = (props) => {
|
||||
} else {
|
||||
attribute.push({ fieldId: attributeId, value: value })
|
||||
}
|
||||
formik.setFieldValue('attributes', attribute)
|
||||
formik.setFieldValue('printAttributes', attribute)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ export const useCreatePrintForm = () => {
|
||||
params,
|
||||
}: {
|
||||
orderId: string;
|
||||
itemId: number;
|
||||
itemId: string;
|
||||
params: CreatePrintFormType;
|
||||
}) => api.createPrintForm(orderId, itemId, params),
|
||||
// onSuccess: (_, params) => {
|
||||
|
||||
@@ -23,7 +23,7 @@ export const updateSection = async (id: number, params: CreateSectionType) => {
|
||||
|
||||
export const getSectionDetail = async (id: number) => {
|
||||
const { data } = await axios.get<SectionDetailResponseType>(
|
||||
`/admin/section/${id}`
|
||||
`/admin/section/${id}`,
|
||||
);
|
||||
return data;
|
||||
};
|
||||
@@ -35,12 +35,12 @@ export const deleteSection = async (id: number) => {
|
||||
|
||||
export const createPrintForm = async (
|
||||
orderId: string,
|
||||
itemId: number,
|
||||
params: CreatePrintFormType
|
||||
itemId: string,
|
||||
params: CreatePrintFormType,
|
||||
) => {
|
||||
const { data } = await axios.patch(
|
||||
`/admin/orders/${orderId}/item/${itemId}/print`,
|
||||
params
|
||||
params,
|
||||
);
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@ export type SectionsResponseType = BaseResponse<SectionItemType[]>;
|
||||
export type SectionDetailResponseType = BaseResponse<SectionItemType>;
|
||||
|
||||
export type PrintAttributesType = {
|
||||
fieldId: number;
|
||||
fieldId: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user