Commit d36cfae8 authored by 우지원's avatar 우지원
Browse files

Merge remote-tracking branch 'origin/jaeyeon' into woojiweon2

parents 93d06f1e 8ec958be
...@@ -21,8 +21,8 @@ function App() { ...@@ -21,8 +21,8 @@ function App() {
<Route exact path="/login" component={LoginPage} /> <Route exact path="/login" component={LoginPage} />
<Route path="/profile/:id/update" component={InfoUpdatePage} /> <Route path="/profile/:id/update" component={InfoUpdatePage} />
<Route path="/profile/:id" component={ProfilePage} /> <Route path="/profile/:id" component={ProfilePage} />
<Route path="/room/:roomId/main" component={InitRoomPage} />
<Route path="/room/:roomId/:channelId" component={RoomPage} /> <Route path="/room/:roomId/:channelId" component={RoomPage} />
<Route path="/room/:roomId" component={InitRoomPage} />
<Route path="/room/Invite" component={InvitePage} /> <Route path="/room/Invite" component={InvitePage} />
</Switch> </Switch>
{/* </AuthProvider> */} {/* </AuthProvider> */}
......
...@@ -39,7 +39,7 @@ const JoinRoom = () => { ...@@ -39,7 +39,7 @@ const JoinRoom = () => {
if (success) { if (success) {
// console.log('success', success) // console.log('success', success)
alert('룸참여가 완료되었습니다!') alert('룸참여가 완료되었습니다!')
window.location.href=`/room/${roomId}/1` window.location.href=`/room/${roomId}/main`
} }
return ( return (
......
...@@ -4,61 +4,78 @@ import { useParams } from "react-router-dom"; ...@@ -4,61 +4,78 @@ import { useParams } from "react-router-dom";
import roomApi from "../../apis/room.api"; import roomApi from "../../apis/room.api";
const INIT_ROOM = { const INIT_ROOM = {
id: "", id: "",
name: "", name: "",
profileimg: "", profileimg: "",
}; };
const InitRoom = () => { const InitRoom = () => {
const { roomId } = useParams(); const { roomId } = useParams();
const [room, setRoom] = useState(INIT_ROOM); const [room, setRoom] = useState(INIT_ROOM);
const [error, setError] = useState(""); const [error, setError] = useState("");
async function getRoom(roomId) { async function getRoom(roomId) {
console.log(roomId) try {
try { const data = await roomApi.getRoom([roomId]);
const data = await roomApi.getRoom([roomId]); setRoom(data[0]);
setRoom(data[0]); } catch (error) {
} catch (error) { catchErrors(error, setError);
catchErrors(error, setError);
}
} }
console.log(room) }
useEffect(() => { useEffect(() => {
console.log('roomId확인', roomId) getRoom(roomId);
getRoom(roomId); }, [roomId]);
}, [roomId]);
return ( return (
<div> <div>
<div style={{ backgroundColor: "#262626", width: "auto", height: "2px" }} /> <div
<form className="flex-row align-items-center justify-content-center m-5"> style={{ backgroundColor: "#262626", width: "auto", height: "2px" }}
<div className="d-flex justify-content-center"> />
<img <form className="flex-row align-items-center justify-content-center m-5">
src={`/roomUploads/${room.profileimg}`} <div className="d-flex justify-content-center">
className="rounded-circle" <img
style={{ src={`/roomUploads/${room.profileimg}`}
width: "250px", className="rounded-circle"
height: "250px", style={{
}} width: "250px",
/> height: "250px",
</div> }}
<div className="d-flex justify-content-center mt-3"> />
<div>
<div className="row">
<h6 className="col" style={{ text: 'center' }}> 방이름 </h6>
<h4 className="col"> {room.name} </h4>
</div>
<div className="row">
<h6 className="col"> 방코드 </h6>
<h4 className="col"> {room.id} </h4>
</div>
</div>
</div>
</form>
</div> </div>
); <div className="row">
<div className="col-3"></div>
<div className="col-6 my-5">
<h2
className="mb-3"
style={{ fontSize: "13px", fontWeight: "bold" }}
>
이름
</h2>
<h2
className="mb-4 mt-2"
style={{ fontSize: "25px", fontWeight: "bold" }}
>
{room.name}
</h2>
<h2
className="mb-3 mt-2"
style={{ fontSize: "13px", fontWeight: "bold" }}
>
코드
</h2>
<h2
className="mb-3 mt-2"
style={{ fontSize: "25px", fontWeight: "bold" }}
>
{room.id}
</h2>
</div>
<div className="col"></div>
</div>
</form>
</div>
);
}; };
export default InitRoom; export default InitRoom;
...@@ -23,21 +23,21 @@ sequelize ...@@ -23,21 +23,21 @@ sequelize
roomNumber : ["1234567abc","abc7654321"], roomNumber : ["1234567abc","abc7654321"],
}); });
await Room.create({ // await Room.create({
id: "1234567abc", // id: "1234567abc",
name: "room", // name: "room",
owner: 8888, // owner: 8888,
member: ['8888', '9999'], // member: [8888],
profileimg: "defaultimg", // profileimg: "defaultimg",
}); // });
await Room.create({ // await Room.create({
id: "abc7654321", // id: "abc7654321",
name: "room1", // name: "room1",
owner: 9999, // owner: 9999,
member: ['9999'], // member: [9999],
profileimg: "defaultimg", // profileimg: "defaultimg",
}); // });
app.listen(appConfig.port, () => { app.listen(appConfig.port, () => {
console.log(`Server is running on port ${appConfig.port}`); console.log(`Server is running on port ${appConfig.port}`);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment