diff --git a/.env b/.env index c2ef360..611f4dd 100644 --- a/.env +++ b/.env @@ -1,2 +1,3 @@ VITE_TOKEN_NAME = 'negareh_t' -VITE_REFRESH_TOKEN_NAME = 'negareh_rt' \ No newline at end of file +VITE_REFRESH_TOKEN_NAME = 'negareh_rt' +VITE_API_BASE_URL = 'http://192.168.99.235:4000' diff --git a/src/config/axios.ts b/src/config/axios.ts index 231213b..6bcdf09 100644 --- a/src/config/axios.ts +++ b/src/config/axios.ts @@ -2,7 +2,7 @@ import axios from "axios"; import { getToken } from "./func"; const instance = axios.create({ - baseURL: import.meta.env.VITE_API_URL || "http://localhost:3000/api", + baseURL: import.meta.env.VITE_API_BASE_URL || "http://localhost:3000/api", timeout: 10000, }); @@ -16,7 +16,7 @@ instance.interceptors.request.use( }, (error) => { return Promise.reject(error); - } + }, ); instance.interceptors.response.use( @@ -27,7 +27,7 @@ instance.interceptors.response.use( console.log("Unauthorized"); } return Promise.reject(error); - } + }, ); export default instance; diff --git a/src/pages/order/NewOrder.tsx b/src/pages/order/NewOrder.tsx index cfeffbe..f0f0486 100644 --- a/src/pages/order/NewOrder.tsx +++ b/src/pages/order/NewOrder.tsx @@ -1,11 +1,5 @@ -import Button from '@/components/Button' -import Input from '@/components/Input' -import Select from '@/components/Select' -import UploadBox from '@/components/UploadBox' -import VoiceRecorder from '@/components/VoiceRecorder' -import { COLORS } from '@/constants/colors' -import { AddSquare } from 'iconsax-react' import { type FC } from 'react' +import Order from './components/Order' const NewOrder: FC = () => { return ( @@ -14,58 +8,7 @@ const NewOrder: FC = () => { سفارش جدید -
-
اطلاعات سفارش
- -
- - - -
- -
- { - console.log('ضبط صدا تکمیل شد:', blob) - }} - /> -
- -
- -
- -
- -
-
+ ) } diff --git a/src/pages/order/components/Order.tsx b/src/pages/order/components/Order.tsx new file mode 100644 index 0000000..5d2caa2 --- /dev/null +++ b/src/pages/order/components/Order.tsx @@ -0,0 +1,64 @@ +import { type FC } from 'react' +import Button from '@/components/Button' +import Input from '@/components/Input' +import Select from '@/components/Select' +import UploadBox from '@/components/UploadBox' +import VoiceRecorder from '@/components/VoiceRecorder' +import { COLORS } from '@/constants/colors' +import { AddSquare } from 'iconsax-react' +import ProductsSelect from './ProductsSelect' + +const Order: FC = () => { + return ( +
+
اطلاعات سفارش
+ +
+ +
+ +
+ +
+ +
+ { + console.log('ضبط صدا تکمیل شد:', blob) + }} + /> +
+ +
+ +
+ +
+ +
+
+ ) +} + +export default Order \ No newline at end of file diff --git a/src/pages/order/components/ProductsSelect.tsx b/src/pages/order/components/ProductsSelect.tsx new file mode 100644 index 0000000..b1e5e2e --- /dev/null +++ b/src/pages/order/components/ProductsSelect.tsx @@ -0,0 +1,28 @@ +import { type FC, type SelectHTMLAttributes } from 'react' +import { useGetProducts } from '../hooks/useOrderData' +import Select from '@/components/Select' + +type Props = { + error_text?: string, +} & SelectHTMLAttributes + +const ProductsSelect: FC = (props) => { + + const { data } = useGetProducts() + + return ( +