Skip to content

Commit

Permalink
Merge pull request #70 from Bae-chaegyeom/Mypage
Browse files Browse the repository at this point in the history
[client] / #11,13,14,15 / Fix Mypage function
  • Loading branch information
GriGni authored Nov 19, 2020
2 parents 2b3f6e3 + 106b172 commit 45a5856
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 40 deletions.
10 changes: 3 additions & 7 deletions my-app/src/components/Mypage/EditInfoModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,16 @@ export default class EditInfoModal extends React.Component {
}
})
.then((res) => {
console.log("뭐가 찍히는게야",res.response)
// if (res.status === 200) {
// <Redirect to="/mypage"></Redirect> }



console.log("뭐가 찍히는게야", res.response)
this.props.editinfo()
})
.catch((err) => {
console.dir(err)
})
};

render() {
// {console.log('프롭스 뱉어라',this.props)}
{console.log('프롭스 뱉어라',this.props)}
if (!this.props.show) {
return null
}
Expand Down
1 change: 0 additions & 1 deletion my-app/src/components/Mypage/EditInfoPasswordModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default class EditInfoPasswordModal extends React.Component {
};

render() {
{console.log('프롭스 뱉어라',this.props)}
if (!this.props.show) {
return null
}
Expand Down
21 changes: 20 additions & 1 deletion my-app/src/components/Mypage/Footer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/* eslint-disable */
import React from "react";
import axios from "axios"
import { Link, Route, Redirect } from "react-router-dom"
axios.defaults.withCredentials = true;

class Footer extends React.Component {
constructor(props) {
Expand All @@ -8,10 +12,25 @@ class Footer extends React.Component {
};
}

handleUserRemove = () => {
axios({
method: 'post',
url: 'http://13.209.99.91:3001/user/remove',
},{withCredentials :true}
).then((res) => {
localStorage.removeItem('isLogin')
console.log("삭제 된거니?",res)
})
}


render() {
return (
<footer className="mypage_deleteinfo">
<button id="delete_myinfo">계정삭제</button>
<Link to="/" id="delete_myinfo" onClick={() => { this.handleUserRemove() }}>
계정삭제
</Link>

</footer>
);
}
Expand Down
49 changes: 28 additions & 21 deletions my-app/src/components/Mypage/MyToGoList.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
/* eslint-disable */
import React from "react";

const MyToGoList = (props) => {
return (
<div className="mypage_mylist">
<div className="mypage_mycontent_boxs">
{props.post.length === 0 ? "가고 싶은 곳을 등록해주세요!" :
props.post.map(function (el) {
return (

<div className="mypage_mycontent_frame">
<div className="mypage_mycontent_map">{el.mapimgpath && el.mapimgpath}</div>
<div className="mypage_mycontent_content">{el.content}</div>
<div className="mypage_mycontent_tag">{el.hashtags.length === 0 ? '' :
el.hashtags.map(function (ele) {
return (ele.tag)
})
}</div>

</div>
)
})
}
{console.log(props.post)}
</div>
</div>
)
}

class MyToGoList extends React.Component {
constructor(props) {
super(props);
this.state = {

};
}
export default MyToGoList;

render() {
return (
<section className="mypage_mylist">
<div className="mypage_mycontent_box">
<div className="mypage_mycontent_frame">
<div className="mypage_mycontent_map"></div>
<div className="mypage_mycontent_content">내용이 들어갈 겁니다!</div>
<div className="mypage_mycontent_tag">태그태그</div>
</div>
</div>
</section>
);
}
}

export default MyToGoList;
6 changes: 6 additions & 0 deletions my-app/src/components/Mypage/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Nav extends React.Component {
}
).then(res => {
console.log(res)
localStorage.removeItem('isLogin')
this.props.history.push("/")
}

Expand All @@ -44,6 +45,11 @@ class Nav extends React.Component {
로그아웃
</Link>
</div>
<div className="Mypage_logout_btn_box">
<Link to='/start' className="Mypage_logout_btn" >
기능페이지
</Link>
</div>

</div>
)
Expand Down
18 changes: 13 additions & 5 deletions my-app/src/routes/Mypage.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@
height: 60%;
width: 10%;
border: 2px solid #937666;
border-radius: 2px;
border-radius: 5px;
transform: translateY(30%);
text-align: center;
margin-left: 2px;
margin-right: 2px;
}
.Mypage_logout_btn {
color: #937666;
text-align: center;
}
/* 회원정보칸 */
Expand Down Expand Up @@ -153,15 +156,16 @@ dd {
.mypage_mylist {
position: static;
/* border: 2px solid black; */
height: auto;
padding-left: 55px;
padding-right: 55px;
padding-top: 20px;
padding-bottom: 20px;
height: auto;

margin: 0 auto;
}
.mypage_mycontent_box {
height: 600px;
.mypage_mycontent_boxs {
height: auto;
border: 2px solid #937666;
border-radius: 10px;
padding: 20px;
Expand All @@ -171,6 +175,7 @@ dd {
border: 2px solid #937666;
border-radius: 10px;
padding: 10px;
margin-bottom: 10px;
}
.mypage_mycontent_map {
width: 100%;
Expand All @@ -182,13 +187,15 @@ dd {
.mypage_mycontent_content {
width: 100%;
height: auto;
font-size: 12px;
border: 2px solid #937666;
border-radius: 10px;
padding: 10px;
margin-bottom: 10px;
}
.mypage_mycontent_tag {
width: 100%;
font-size: 12px;
height: auto;
border: 2px solid #937666;
border-radius: 10px;
Expand All @@ -197,7 +204,7 @@ dd {
/* 계정삭제 */
.mypage_deleteinfo {
position: fixed static;
bottom: 0;
/* bottom: 0; */
height: 50px;
}
#delete_myinfo {
Expand All @@ -214,6 +221,7 @@ dd {
border-radius: 5px;
background: 0;
background-color: #e9ad17;
text-align: center;
color: #fff !important;
/* text-shadow: none; */
border: 1px solid transparent;
Expand Down
31 changes: 28 additions & 3 deletions my-app/src/routes/Mypage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Mypage extends React.Component{
username: '',
phonenum: '',
userInfo: '',
userPost: '',
editInfoCheck: false,
editInfoModalShow: false,
deleteinfoModalShow: false
Expand All @@ -46,10 +47,33 @@ class Mypage extends React.Component{
userInfo:res.data
})
console.log("나오는거야 뭐야",res)
})

axios({
method: 'get',
url: 'http://13.209.99.91:3001/post',
},{withCredentials :true}
).then((res) => {
this.setState({
userPost:res.data
})
console.log("포스트 받아오니?",res)
})


}
editUserInfo = () => {
axios({
method: 'get',
url: 'http://13.209.99.91:3001/user/info',
},{withCredentials :true}
).then((res) => {
this.setState({
userInfo:res.data
})
console.log("제발 되라",res)
})
}

//유저정보를 수정하기 위해서 비밀번호확인하는 모달창을 띄우게 할지 state 변경하는 함수
editInfoPasswordShow = e => {
Expand All @@ -68,16 +92,17 @@ class Mypage extends React.Component{
return (

<div className="mypage_page">
{!localStorage.isLogin && <Redirect to="/" />}
{console.log('디드마운트하면 없어져? ',this.state.userInfo)}
<EditInfoPasswordModal onClose={this.editInfoPasswordShow} show={this.state.editInfoCheck} onShow={this.editInfoPasswordShowModal}>
정보를 수정하기 위해서 비밀번호를 입력해 주세요
</EditInfoPasswordModal>
<EditInfoModal onClose={this.editInfoPasswordShowModal} show={this.state.editInfoModalShow}>
<EditInfoModal onClose={this.editInfoPasswordShowModal} show={this.state.editInfoModalShow} editinfo={this.editUserInfo}>
된거냐
</EditInfoModal>
<Nav />
<UserInfo passwordcheck={this.editInfoPasswordShow} userinfo={this.state.userInfo}/>
<MyToGoList />
<UserInfo passwordcheck={this.editInfoPasswordShow} userinfo={this.state.userInfo} />
<MyToGoList post={this.state.userPost }/>
<Footer />
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions my-app/src/routes/Signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class Signin extends React.Component{
if (this.state.keepLoggedInChecked) {
localStorage.setItem('isLogin', true)
}
localStorage.setItem('isLogin', true)
this.props.history.push("/start");
})
// this.props.history.push("/start");
Expand Down Expand Up @@ -131,7 +132,7 @@ class Signin extends React.Component{
sessionStorage.setItem("userid", res.data.id)
localStorage.setItem('isLogin', true)
}

localStorage.setItem('isLogin', true)
this.props.history.push("/start");

})
Expand All @@ -151,7 +152,6 @@ class Signin extends React.Component{
return (

<div className="signin_page">
{/* {console.log(this.props)} */}
{localStorage.isLogin ? <Redirect to="/start" /> : ''}
<SigninEmptyModal onClose={this.showModal} show={ this.state.show }>이메일과 비밀번호를 입력해 주세요</ SigninEmptyModal>
<div className="signin_frame">
Expand Down

0 comments on commit 45a5856

Please sign in to comment.