Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client server total test #88

Merged
merged 2 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/MyPages/MyPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ import Character4 from '../images/Character4.png';

function MyPage({ accessToken, isLogIn, loginCheck, userInfo }) {
const PhotoData = [Character1, Character2, Character3, Character4];
const [nowPhoto, setPhoto] = useState(Character1);

const [isOpen, setIsOpen] = useState(false);
const [isPhotoBoxOpen, setIsPhotoBoxOpen] = useState(false);
const { nickname, email, profile_image, comment, id } = userInfo
const defaultImageNum = profile_image === null ? 0 : profile_image
const [nowPhoto, setPhoto] = useState(PhotoData[defaultImageNum]);
const ChangeInputPhoto = function (photo) {
// e.preventDefault();
setPhoto(photo);
Expand Down Expand Up @@ -42,6 +45,23 @@ function MyPage({ accessToken, isLogIn, loginCheck, userInfo }) {
};
});



const MyPageSaveData= async () =>{
const PhotoNum = PhotoData.findIndex(nowPhoto)
const SavePhoto = await axios.post(`http://localhost:4000/mypage/${id}/profile`,
{
authorization: accessToken,
new_profile: PhotoNum
},
{
headers: { 'Content-Type': 'application/json' },
Credentials: 'include',
})
}



return (
<div>
<Header isOpen={isOpen} nowPhoto={nowPhoto} />
Expand Down
1 change: 1 addition & 0 deletions src/WaitingPages/Waiting.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default function Waiting({
// Handle forward event
} else {
setLocationKeys((keys) => [location.key, ...keys]);

history.push('/Waiting');
}
}
Expand Down