diff --git a/src/App.js b/src/App.js index 791b628..e1966db 100644 --- a/src/App.js +++ b/src/App.js @@ -74,6 +74,8 @@ export default function App() { //return this.setState({ email: message, createdAt: message }); } const { nickname, email, profile_image } = res.data.data.userInfo; + console.log(res.data.data.accessToken) + setAccessToken({accessToken:res.data.data.accessToken}) setUserInfo({ nickname: nickname, email: email, @@ -124,6 +126,7 @@ export default function App() { }; return (
+ { diff --git a/src/MyPages/MyPage.js b/src/MyPages/MyPage.js index f847fd6..9177d2d 100644 --- a/src/MyPages/MyPage.js +++ b/src/MyPages/MyPage.js @@ -8,6 +8,7 @@ import Character1 from '../images/Character1.png'; import Character2 from '../images/Character2.png'; import Character3 from '../images/Character3.png'; import Character4 from '../images/Character4.png'; +import axios from 'axios'; function MyPage({ accessToken, isLogIn, loginCheck, userInfo }) { const PhotoData = [Character1, Character2, Character3, Character4]; @@ -46,20 +47,24 @@ 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', - } - ); - }; + 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', + }) + const SaveComment = await axios.post(`http://localhost:4000/mypage/${id}/comment`, + { + authorization: accessToken, + Comment: PhotoNum + }) + } + return (