fix: create product
This commit is contained in:
@@ -12,8 +12,11 @@ import { Edit } from 'iconsax-react';
|
||||
import Button from '@/components/Button';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Pages } from '@/config/Pages';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
const List: FC = () => {
|
||||
|
||||
const navigate = useNavigate();
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const { data: productsData, isLoading, error } = useGetProducts(currentPage);
|
||||
|
||||
@@ -59,7 +62,14 @@ const List: FC = () => {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className='relative overflow-x-auto rounded-3xl mt-9 w-full'>
|
||||
<div className='flex justify-end mt-5'>
|
||||
<Button
|
||||
label='افزودن محصول'
|
||||
onClick={() => navigate(`${Pages.products.create}`)}
|
||||
className='w-fit'
|
||||
/>
|
||||
</div>
|
||||
<div className='relative overflow-x-auto rounded-3xl mt-5 w-full'>
|
||||
<table className='w-full text-sm'>
|
||||
<thead className='thead'>
|
||||
<tr>
|
||||
|
||||
@@ -170,7 +170,7 @@ const Step3Form: FC<Step3FormProps> = ({ onSubmit, loading, onPrevious, initialD
|
||||
isLoading={loading || uploadMultipleMutation.isPending}
|
||||
disabled={selectedFiles.length === 0 && uploadedImages.length === 0 && !selectedCoverFile && !coverImage}
|
||||
>
|
||||
بروزرسانی محصول
|
||||
ذخیره
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -25,21 +25,21 @@ import {
|
||||
export const createProductDetail = async (
|
||||
variables: CreateProductDetailRequestType
|
||||
): Promise<CreateProductDetailResponseType> => {
|
||||
const { data } = await axios.post("/admin/products/create/detail", variables);
|
||||
const { data } = await axios.post("/admin/products/creation/detail", variables);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const createProductAttribute = async (
|
||||
variables: CreateProductAttributeRequestType
|
||||
): Promise<CreateProductAttributeResponseType> => {
|
||||
const { data } = await axios.post("/admin/products/create/attribute", variables);
|
||||
const { data } = await axios.post("/admin/products/creation/attribute", variables);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const saveProduct = async (
|
||||
variables: SaveProductRequestType
|
||||
): Promise<SaveProductResponseType> => {
|
||||
const { data } = await axios.post("/admin/products/create/save", variables);
|
||||
const { data } = await axios.post("/admin/products/creation/save", variables);
|
||||
return data;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user