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

/user/:id

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