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