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

e

parent 0c3731f4
......@@ -3,11 +3,11 @@ import { Redirect } from "react-router-dom";
import roomApi from "../../apis/room.api";
import catchErrors from "../../context/catchError";
const userId = localStorage.getItem('user');
const id = localStorage.getItem('user');
const INIT_ROOM = {
name: '',
owner: userId,
member: userId,
owner: id,
member: id,
profileimg: '',
}
......@@ -43,9 +43,9 @@ const CreateRoom = () => {
}
if (success) {
console.log('success', success)
// console.log('success', success)
alert('룸생성이 완료되었습니다!')
return <Redirect to='/user/:id' />
return <Redirect to={`/user/${id}`} />
}
const { name, owner, member, profileimg } = room;
......
......@@ -3,7 +3,7 @@ import { Redirect } from "react-router-dom";
import roomApi from "../../apis/room.api";
import catchErrors from "../../context/catchError";
const userId = localStorage.getItem("user");
const id = localStorage.getItem("user");
const JoinRoom = () => {
const [roomId, setRoomId] = useState("");
......@@ -26,7 +26,7 @@ const JoinRoom = () => {
try {
// setLoading(true);
setError("");
const data = await roomApi.join({ userId: userId, roomId: roomId });
const data = await roomApi.join({ userId: id, roomId: roomId });
setSuccess(true);
} catch (error) {
catchErrors(error, setError);
......@@ -34,8 +34,11 @@ const JoinRoom = () => {
// setLoading(false);
}
}
if (success) {
return <Redirect to="/user" />;
// console.log('success', success)
alert('룸참여가 완료되었습니다!')
return <Redirect to={`/user/${id}`} />;
}
return (
......
......@@ -6,7 +6,7 @@ import userApi from '../../apis/user.api';
const RoomSingle = () => {
const [roomNum, setRoomNum] = useState('')
const [room, setRoom] = useState([])
const id = localStorage.getItem('user');
const roomId = localStorage.getItem('user');
const channelId = 1
const A = []
......@@ -30,7 +30,7 @@ const RoomSingle = () => {
return (
<Link
to={`/room/${id}/${channelId}`}
to={`/room/${roomId}/${channelId}`}
className="text-decoration-none text-dark"
>
<div
......
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