Generateurv2/frontend/components/room/roomEdit.jsx

26 lines
716 B
React
Raw Normal View History

2022-06-24 13:42:16 +02:00
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"
}