diff --git a/src/App copy.jsx b/src/App copy.jsx new file mode 100644 index 0000000..0a0016e --- /dev/null +++ b/src/App copy.jsx @@ -0,0 +1,13 @@ +import React from "react"; + +import { Authenticated } from "./components"; + +import { Router } from "./router"; + +const App = () => ( + + + +); + +export default App; diff --git a/src/components/form/formCreateItem.jsx b/src/components/form/formCreateItem.jsx new file mode 100644 index 0000000..c9bd3f6 --- /dev/null +++ b/src/components/form/formCreateItem.jsx @@ -0,0 +1,78 @@ +import React, { useState, useEffect } from "react"; +import { Form, Input, InputNumber, Button, Select } from "antd"; +import axios from "axios"; + +const { TextArea } = Input; +const { Option } = Select; + +export const FormCreateItem = () => { + const [form] = Form.useForm(); + const [rooms, setRooms] = useState([]); + + useEffect(() => { + const fetchRooms = async () => { + try { + const response = await axios.get( + `${import.meta.env.VITE_API_URL}/room`, + ); + setRooms(response.data); + } catch (error) { + console.error(error); + } + }; + + fetchRooms(); + }, []); + + const onFinish = async (values) => { + try { + const response = await axios.post( + `${import.meta.env.VITE_API_URL}/item`, + values, + ); + console.log(response.data); + } catch (error) { + console.error(error); + } + }; + + return ( +
+

Create Item

+ + + + + + + + + + + + + + + + +