import { useParams } from "react-router-dom"; import React, { useEffect, useState } from "react"; import RoomApi from "../../apis/room.api"; import catchErrors from "../../context/catchError"; const INIT_Room = { id: "", name: "", }; const Roomnamechange = () => { const { roomId } = useParams(); const [Room, setRoom] = useState(INIT_Room); const [error, setError] = useState(""); Room.id = roomId; async function getdata(Roomdata) { try { const data = await RoomApi.getRoom([Roomdata]); setRoom(data); console.log(data); } catch (error) { catchErrors(error, setError); } } useEffect(() => { getdata(roomId); }, []); const updateinfo = (event) => { const { name, value } = event.target; setRoom({ ...Room, [name]: value }); console.log(Room); }; const changeinfo = async (event) => { const req = await RoomApi.changename(Room); }; return (
); }; export default Roomnamechange;