fix error
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
VITE_TOKEN_NAME = 'negareh_t'
|
VITE_TOKEN_NAME = 'negareh_t'
|
||||||
VITE_REFRESH_TOKEN_NAME = 'negareh_rt'
|
VITE_REFRESH_TOKEN_NAME = 'negareh_rt'
|
||||||
VITE_API_BASE_URL = 'http://192.168.99.218:4000'
|
VITE_API_BASE_URL = 'https://negareh-api.dev.danakcorp.com'
|
||||||
|
|||||||
@@ -52,19 +52,21 @@ const MyOrders: FC = () => {
|
|||||||
onChange={() => { }}
|
onChange={() => { }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Link to={Paths.newOrder}>
|
||||||
className='w-fit px-5'
|
<Button
|
||||||
>
|
className='w-fit px-5'
|
||||||
<div className='flex items-center gap-2'>
|
>
|
||||||
<AddSquare
|
<div className='flex items-center gap-2'>
|
||||||
size={16}
|
<AddSquare
|
||||||
color='#000000'
|
size={16}
|
||||||
/>
|
color='#000000'
|
||||||
<span>
|
/>
|
||||||
سفارش جدید
|
<span>
|
||||||
</span>
|
سفارش جدید
|
||||||
</div>
|
</span>
|
||||||
</Button>
|
</div>
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='mt-10'>
|
<div className='mt-10'>
|
||||||
|
|||||||
@@ -88,8 +88,9 @@ const Order: FC<Props> = ({ addNewItem }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const handleChange = (e: ChangeEvent<HTMLSelectElement>) => {
|
const handleChange = (e: ChangeEvent<HTMLSelectElement>) => {
|
||||||
const productId = e.target.value
|
const productId: string = e.target.value
|
||||||
const product = data?.data?.find(o => Number(o.id) === Number(productId))
|
const product = data?.data?.find(o => o.id === productId)
|
||||||
|
|
||||||
if (product) {
|
if (product) {
|
||||||
if (product.quantities[0] !== 0) {
|
if (product.quantities[0] !== 0) {
|
||||||
product.quantities.unshift(0)
|
product.quantities.unshift(0)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const useGetProducts = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useGetAttributes = (id?: number) => {
|
export const useGetAttributes = (id?: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ["products-attributes", id],
|
queryKey: ["products-attributes", id],
|
||||||
queryFn: () => api.getAttributes(id),
|
queryFn: () => api.getAttributes(id),
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ export const getProducts = async () => {
|
|||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAttributes = async (productId?: number) => {
|
export const getAttributes = async (productId?: string) => {
|
||||||
const { data } = await axios.get<AttributeResponseType>(
|
const { data } = await axios.get<AttributeResponseType>(
|
||||||
`/public/entity/${productId}/field`
|
`/public/entity/${productId}/field`,
|
||||||
);
|
);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
@@ -29,7 +29,7 @@ export const submitOrder = async (params: OrderType[]) => {
|
|||||||
|
|
||||||
export const getMyOrders = async (
|
export const getMyOrders = async (
|
||||||
page: number = 1,
|
page: number = 1,
|
||||||
active: TabMyOrdersEnum
|
active: TabMyOrdersEnum,
|
||||||
) => {
|
) => {
|
||||||
const statuses =
|
const statuses =
|
||||||
active === TabMyOrdersEnum.IN_PROGRESS
|
active === TabMyOrdersEnum.IN_PROGRESS
|
||||||
@@ -55,21 +55,21 @@ export const getMyOrders = async (
|
|||||||
query += `&statuses=${statuses}`;
|
query += `&statuses=${statuses}`;
|
||||||
}
|
}
|
||||||
const { data } = await axios.get<MyOrdersResponseType>(
|
const { data } = await axios.get<MyOrdersResponseType>(
|
||||||
`/public/orders${query}`
|
`/public/orders${query}`,
|
||||||
);
|
);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getOrderDetails = async (id: string) => {
|
export const getOrderDetails = async (id: string) => {
|
||||||
const { data } = await axios.get<OrderDetailResponseType>(
|
const { data } = await axios.get<OrderDetailResponseType>(
|
||||||
`/public/orders/${id}`
|
`/public/orders/${id}`,
|
||||||
);
|
);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getTickets = async (id: string) => {
|
export const getTickets = async (id: string) => {
|
||||||
const { data } = await axios.get<TicketsResponseType>(
|
const { data } = await axios.get<TicketsResponseType>(
|
||||||
`/public/ticket/order/item/${id}`
|
`/public/ticket/order/item/${id}`,
|
||||||
);
|
);
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export type ProductType = {
|
|||||||
category: CategoryType;
|
category: CategoryType;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
desc: string;
|
desc: string;
|
||||||
id: number;
|
id: string;
|
||||||
images?: string[];
|
images?: string[];
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
linkUrl: string;
|
linkUrl: string;
|
||||||
@@ -82,7 +82,7 @@ export interface MyOrderType extends RowDataType {
|
|||||||
total: number;
|
total: number;
|
||||||
items: {
|
items: {
|
||||||
adminDescription?: string;
|
adminDescription?: string;
|
||||||
id: number;
|
id: string;
|
||||||
attachments: {
|
attachments: {
|
||||||
type: string;
|
type: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user