Skip to content

Commit

Permalink
Merge pull request #92 from cjs1301/dev
Browse files Browse the repository at this point in the history
hoxfix token
  • Loading branch information
cjs1301 authored May 6, 2021
2 parents 342fa2e + 2543e21 commit 79a9003
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
3 changes: 3 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -124,6 +126,7 @@ export default function App() {
};
return (
<div>
<button onClick={refreshTokenRequest}>리프레쉬 토큰</button>
<Switch>
<Route
path="/Waiting"
Expand Down
2 changes: 1 addition & 1 deletion src/MainPages/components/Signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function Signin({ isOpen, close, loginHandler }) {
{ email, password },
{
headers: { 'Content-Type': 'application/json' },
Credentials: 'include',
withCredentials: true,
}
)
.then((res) => {
Expand Down
33 changes: 19 additions & 14 deletions src/MyPages/MyPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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 (
<div>
Expand Down

0 comments on commit 79a9003

Please sign in to comment.