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

/user/:id

parent e73fe78d
......@@ -13,7 +13,7 @@ function App() {
{/* <AuthProvider> */}
<Switch>
<Route exact path="/" component={HomeGuestPage} />
<Route exact path="/user" component={HomeUserPage} />
<Route exact path="/user/:id" component={HomeUserPage} />
<Route path="/profile/:id/update" component={InfoUpdatePage} />
<Route path="/profile/:id" component={ProfilePage} />
<Route path="/room/:roomId/:channelId" component={RoomPage} />
......
......@@ -10,7 +10,7 @@ const Header = () => {
>
<div className="d-flex justify-content-end">
<div>
<Link to="/user">
<Link to="/user/:id">
<img src="/BORA.png" style={{ width: '160px' }} />
</Link>
</div>
......
......@@ -48,7 +48,7 @@ const CreateRoom = () => {
if (success) {
console.log('success', success)
alert('룸생성이 완료되었습니다!')
return <Redirect to='/user' />
return <Redirect to='/user/:id' />
}
const { name, owner, member, profileimg } = room;
......
......@@ -16,7 +16,8 @@ const HomeProfile = () => {
async function getSetUser(userID) {
try {
// console.log('userID', userID)
const data = await userApi.getUser(userID)
// `/users/${userId}`
const data = await userApi.getUser(`/user/${userId}`)
// console.log(data)
setUser(data)
// console.log(user)
......
......@@ -38,7 +38,7 @@ const JoinRoom = () => {
}
}
if (success) {
return <Redirect to="/user" />;
return <Redirect to="/user/:id" />;
}
return (
......
......@@ -14,6 +14,7 @@ const Login = () => {
const [disabled, setDisabled] = useState(true)
const [error, setError] = useState('')
const [success, setSuccess] = useState(false)
const [id, setId] = useState('')
useEffect(() => {
const isUser = Object.values(user).every((el) => Boolean(el))
......@@ -33,6 +34,7 @@ const Login = () => {
// setError("");
const data = await userApi.login(user)
console.log(data)
setId(data.id)
handleLogin(data.id)
setSuccess(true)
} catch (error) {
......@@ -44,7 +46,7 @@ const Login = () => {
}
if (success) {
alert('로그인 되었습니다')
return <Redirect to="/user" />
return <Redirect to={`/user/${id}`} />
}
const { email, password } = user
......
......@@ -9,7 +9,7 @@ const ChannelList = () => {
<nav className="navbar navbar-light d-flex justify-content-between">
<LeftHamburger />
<div>
<Link to="/user">
<Link to="/user/:id">
<img src="/BORA.png" style={{ width: '160px' }} />
</Link>
</div>
......
......@@ -105,7 +105,7 @@ const RightHamberger = () => {
</div>
<div className="row mb-3">
<div className="d-flex justify-content-evenly">
{/* <Link to="/user"> */}
{/* <Link to="/user/:id"> */}
<button
type="submit"
className="col-2 p-1 btn btn-primary"
......
......@@ -10,7 +10,7 @@ const InvitePage = () => {
function Invitereject() {
// if () //초대받은 사람이 로그인 o
// <Link to="/user"></Link>//유저 페이지로 이동.
// <Link to="/user/:id"></Link>//유저 페이지로 이동.
// else //로그인x
// <Link to="/"></Link> //메인화면으로 이동.
}
......
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