fix tag
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { type FC, useState, useEffect } from 'react';
|
import { type FC, useState } from 'react';
|
||||||
import Button from '../../../components/Button';
|
import Button from '../../../components/Button';
|
||||||
import Input from '../../../components/Input';
|
import Input from '../../../components/Input';
|
||||||
import Textarea from '../../../components/Textarea';
|
import Textarea from '../../../components/Textarea';
|
||||||
@@ -199,20 +199,14 @@ const ListInput: FC<ListInputProps> = ({ items, onChange, placeholder, label })
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Step2Form: FC<Step2FormProps> = ({ onSubmit, loading, onPrevious, categoryId, initialData }) => {
|
const Step2Form: FC<Step2FormProps> = ({ onSubmit, loading, onPrevious, categoryId, initialData }) => {
|
||||||
const [formData, setFormData] = useState<Omit<CreateProductAttributeRequestType, 'productId'>>({
|
const [formData, setFormData] = useState<Omit<CreateProductAttributeRequestType, 'productId'>>(() => ({
|
||||||
attributes: [],
|
attributes: initialData?.attributes || [],
|
||||||
description: '',
|
description: initialData?.description || '',
|
||||||
metaDescription: '',
|
metaDescription: initialData?.metaDescription || '',
|
||||||
tags: [],
|
tags: initialData?.tags || [],
|
||||||
advantages: [],
|
advantages: initialData?.advantages || [],
|
||||||
disAdvantages: []
|
disAdvantages: initialData?.disAdvantages || []
|
||||||
});
|
}));
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (initialData) {
|
|
||||||
setFormData(prev => ({ ...prev, ...initialData }));
|
|
||||||
}
|
|
||||||
}, [initialData]);
|
|
||||||
|
|
||||||
const { data: categoryAttributesData } = useGetCategoryAttributes(categoryId || '');
|
const { data: categoryAttributesData } = useGetCategoryAttributes(categoryId || '');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user