import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; import { getEditRoomInfos } from '../../requests/requests.room.js'; import styles from '../../styles/room/roomEdit.module.scss'; export default function RoomEdit({ id_code, user }) { const router = useRouter() useEffect(() => { if (!user.owner) { router.push("/room/" + roomCode, undefined, { shallow: true, }); } }, []); const[data, setData] = useState() useEffect(() => { if (!data) { getEditRoomInfos(id_code).then((res) => { setData(res) }).catch((err) => { router.push('/room/' + id_code, undefined, {shallow: true}) }) } }) return "edit" }