Skip to content

Commit

Permalink
Merge pull request #108 from JaeHeon-Kim/test2
Browse files Browse the repository at this point in the history
Test2
  • Loading branch information
JaeHeon-Kim authored May 6, 2021
2 parents ee463fd + d926e3a commit a5771ea
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 46 deletions.
3 changes: 2 additions & 1 deletion src/GamePages/InGame.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ export default function InGame({ accessToken, isLogIn, loginCheck, userInfo }) {

return (
<>
<BackBtn />

<div className="justBox"></div>
<div className="GameWindow">
<div className="canvasBox">
Expand Down Expand Up @@ -219,7 +221,6 @@ export default function InGame({ accessToken, isLogIn, loginCheck, userInfo }) {

<div className="startOrQuitBtns">
<GameStartBtn isInGame={isInGame} handleGameStart={handleGameStart} />
<BackBtn />
</div>
</div>
</>
Expand Down
6 changes: 4 additions & 2 deletions src/GamePages/components/BackBtn.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { withRouter, useHistory } from 'react-router-dom';
function BackBtn() {
const history = useHistory();
return (
<span className="Back">
<button onClick={() => history.push('/Waiting')}>대기실</button>
<span>
<button className="Back" onClick={() => history.push('/Waiting')}>
대기실
</button>
</span>
);
}
Expand Down
13 changes: 7 additions & 6 deletions src/GamePages/components/Canvas3.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,13 @@ export default function Canvas3() {
</div>
</div>

<div>
<Paint
handleColorClick={handleColorClick}
reset={reset}
eraserBtn={eraserBtn}
/>
<div className="Paint">
<button className="reset" onClick={reset}>
초기화
</button>
<button className="color white" onClick={eraserBtn}>
지우개
</button>
</div>
</div>
</>
Expand Down
70 changes: 37 additions & 33 deletions src/MyPages/MyPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function MyPage({ accessToken, refreshTokenRequest, userInfo }) {
const [PhotoNum, setPhotoNum] = useState(0);
const [nowPhoto, setPhoto] = useState(PhotoData[profile_image]);
const [text, setText] = useState(null);

// const emailInputValue = (e) => {
// setEmail(e.target.value);
// };
Expand All @@ -30,12 +30,12 @@ function MyPage({ accessToken, refreshTokenRequest, userInfo }) {
// const nickNameInputValue = (e) => {
// setNickName(e.target.value);
// };

const ChangeInputPhoto = function (photo) {
// e.preventDefault();
setPhoto(photo);
setPhotoNum(PhotoData.indexOf(nowPhoto))
console.log(PhotoNum)
setPhotoNum(PhotoData.indexOf(nowPhoto));
console.log(PhotoNum);
if (photo !== nowPhoto) {
openModal();
}
Expand All @@ -57,35 +57,41 @@ function MyPage({ accessToken, refreshTokenRequest, userInfo }) {
console.log('photobox', isPhotoBoxOpen);
};


const MyPageSaveData= async (PhotoNum) =>{

await refreshTokenRequest()
const SavePhoto = await axios.post(`http://localhost:4000/mypage/${id}/profile`,
{new_profile: PhotoNum},
{
headers: {
Authorization: `Bearer ${accessToken.accessToken}`,
'Content-Type': 'application/json',
},
//withCredentials: true,
})
const SaveComment = await axios.post(`http://localhost:4000/mypage/${id}/comment`,
{Comment: '아니라어민어리ㅏㅁㄴ얼'},
{
headers: {
Authorization: `Bearer ${accessToken.accessToken}`,
'Content-Type': 'application/json',
},
//withCredentials: true,
})
}


// const MyPageSaveData = async (PhotoNum) => {
// await refreshTokenRequest();
// const SavePhoto = await axios.post(
// `http://localhost:4000/mypage/${id}/profile`,
// { new_profile: PhotoNum },
// {
// headers: {
// Authorization: `Bearer ${accessToken.accessToken}`,
// 'Content-Type': 'application/json',
// },
// //withCredentials: true,
// }
// );
// const SaveComment = await axios.post(
// `http://localhost:4000/mypage/${id}/comment`,
// { Comment: '아니라어민어리ㅏㅁㄴ얼' },
// {
// headers: {
// Authorization: `Bearer ${accessToken.accessToken}`,
// 'Content-Type': 'application/json',
// },
// //withCredentials: true,
// }
// );
// };

return (
<div>
<Header isOpen={isOpen} nowPhoto={nowPhoto} nickname={nickname} PhotoNum={PhotoNum}MyPageSaveData={MyPageSaveData}/>
<Header
isOpen={isOpen}
nowPhoto={nowPhoto}
nickname={nickname}
PhotoNum={PhotoNum}
// MyPageSaveData={MyPageSaveData}
/>
<content className="container">
<div className="pro_search_box">
<div className="introBox">
Expand All @@ -103,9 +109,7 @@ function MyPage({ accessToken, refreshTokenRequest, userInfo }) {
</div>
<div className="intro">
<h1>자기소개</h1>
<textarea
placeholder={`클릭하여 자신을 소개해 보세요!`}
/>
<textarea placeholder={`클릭하여 자신을 소개해 보세요!`} />
</div>
</div>
<SearchUser />
Expand Down
6 changes: 3 additions & 3 deletions src/MyPages/components/ExitBtn.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import { useHistory } from 'react-router-dom';

export default function ExitBtn({ MyPageSaveData,PhotoNum }) {
export default function ExitBtn({ MyPageSaveData, PhotoNum }) {
const history = useHistory();
return (
<span className="Exit">
<button
onClick={async () => {
await MyPageSaveData(PhotoNum)
onClick={() => {
// MyPageSaveData();
history.push('/Waiting');
}}
>
Expand Down
8 changes: 7 additions & 1 deletion src/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ $button-active-blue: #1669f2; */
display: flex;
flex-direction: column;
align-items: center;
margin-top: 50px;
}

.waiting_btns {
Expand Down Expand Up @@ -1192,3 +1191,10 @@ canvas {
color: white;
top: 10%;
}

.Back {
position: absolute;
top: 0;
right: 0;
width: 100px;
}

0 comments on commit a5771ea

Please sign in to comment.