diff --git a/.env b/.env index 45ff677..6ffa793 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ VITE_TOKEN_NAME = 'negareh_t' 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' diff --git a/src/pages/order/MyOrders.tsx b/src/pages/order/MyOrders.tsx index 5b43855..66c182e 100644 --- a/src/pages/order/MyOrders.tsx +++ b/src/pages/order/MyOrders.tsx @@ -52,19 +52,21 @@ const MyOrders: FC = () => { onChange={() => { }} /> - + + +
diff --git a/src/pages/order/components/Order.tsx b/src/pages/order/components/Order.tsx index 0977062..0afc17e 100644 --- a/src/pages/order/components/Order.tsx +++ b/src/pages/order/components/Order.tsx @@ -88,8 +88,9 @@ const Order: FC = ({ addNewItem }) => { }) const handleChange = (e: ChangeEvent) => { - const productId = e.target.value - const product = data?.data?.find(o => Number(o.id) === Number(productId)) + const productId: string = e.target.value + const product = data?.data?.find(o => o.id === productId) + if (product) { if (product.quantities[0] !== 0) { product.quantities.unshift(0) diff --git a/src/pages/order/hooks/useOrderData.ts b/src/pages/order/hooks/useOrderData.ts index c438064..a244924 100644 --- a/src/pages/order/hooks/useOrderData.ts +++ b/src/pages/order/hooks/useOrderData.ts @@ -10,7 +10,7 @@ export const useGetProducts = () => { }); }; -export const useGetAttributes = (id?: number) => { +export const useGetAttributes = (id?: string) => { return useQuery({ queryKey: ["products-attributes", id], queryFn: () => api.getAttributes(id), diff --git a/src/pages/order/service/OrderService.ts b/src/pages/order/service/OrderService.ts index 84e3716..91b8348 100644 --- a/src/pages/order/service/OrderService.ts +++ b/src/pages/order/service/OrderService.ts @@ -15,9 +15,9 @@ export const getProducts = async () => { return data; }; -export const getAttributes = async (productId?: number) => { +export const getAttributes = async (productId?: string) => { const { data } = await axios.get( - `/public/entity/${productId}/field` + `/public/entity/${productId}/field`, ); return data; }; @@ -29,7 +29,7 @@ export const submitOrder = async (params: OrderType[]) => { export const getMyOrders = async ( page: number = 1, - active: TabMyOrdersEnum + active: TabMyOrdersEnum, ) => { const statuses = active === TabMyOrdersEnum.IN_PROGRESS @@ -55,21 +55,21 @@ export const getMyOrders = async ( query += `&statuses=${statuses}`; } const { data } = await axios.get( - `/public/orders${query}` + `/public/orders${query}`, ); return data; }; export const getOrderDetails = async (id: string) => { const { data } = await axios.get( - `/public/orders/${id}` + `/public/orders/${id}`, ); return data; }; export const getTickets = async (id: string) => { const { data } = await axios.get( - `/public/ticket/order/item/${id}` + `/public/ticket/order/item/${id}`, ); return data; }; diff --git a/src/pages/order/type/Types.ts b/src/pages/order/type/Types.ts index b19bc9b..caabbf1 100644 --- a/src/pages/order/type/Types.ts +++ b/src/pages/order/type/Types.ts @@ -51,7 +51,7 @@ export type ProductType = { category: CategoryType; createdAt: string; desc: string; - id: number; + id: string; images?: string[]; isActive: boolean; linkUrl: string; @@ -82,7 +82,7 @@ export interface MyOrderType extends RowDataType { total: number; items: { adminDescription?: string; - id: number; + id: string; attachments: { type: string; url: string;