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 Input from '../../../components/Input';
|
||||
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 [formData, setFormData] = useState<Omit<CreateProductAttributeRequestType, 'productId'>>({
|
||||
attributes: [],
|
||||
description: '',
|
||||
metaDescription: '',
|
||||
tags: [],
|
||||
advantages: [],
|
||||
disAdvantages: []
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (initialData) {
|
||||
setFormData(prev => ({ ...prev, ...initialData }));
|
||||
}
|
||||
}, [initialData]);
|
||||
const [formData, setFormData] = useState<Omit<CreateProductAttributeRequestType, 'productId'>>(() => ({
|
||||
attributes: initialData?.attributes || [],
|
||||
description: initialData?.description || '',
|
||||
metaDescription: initialData?.metaDescription || '',
|
||||
tags: initialData?.tags || [],
|
||||
advantages: initialData?.advantages || [],
|
||||
disAdvantages: initialData?.disAdvantages || []
|
||||
}));
|
||||
|
||||
const { data: categoryAttributesData } = useGetCategoryAttributes(categoryId || '');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user