Skip to content

Commit

Permalink
client token hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
cjs1301 committed May 6, 2021
1 parent c7d12dc commit 17bfe8a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
28 changes: 23 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,21 @@ export default function App() {
const loginCheck = (isLogIn) => {
if (!isLogIn) {
history.push('/');
}else if(isLogIn){
history.push('/Waiting');
}
};
const hendleLogout = () => {
setIsLogIn(false);
setAccessToken({ accessToken: null });
axios
.get(
'http://localhost:4000/login',
{
headers: { 'Content-Type': 'application/json' },
withCredentials: true,
}
).then((res) => {})
};

const accessTokenRequest = (accessToken) => {
Expand Down Expand Up @@ -109,11 +119,19 @@ export default function App() {

useEffect(() => {
console.log('엑세스 토큰', accessToken.accessToken);
if (accessToken.accessToken !== null) {
setIsLogIn(true);
}
console.log('로그인상태', isLogIn);
}, [accessToken]);
// if (accessToken.accessToken !== null) {
// setIsLogIn(true);
// }
// console.log('로그인상태', isLogIn);
//엑세스 토큰이 없을때
if(accessToken.accessToken===null){
setIsLogIn(true)
loginCheck(isLogIn)
refreshTokenRequest()
console.log('로그인상태',isLogIn)
}
console.log('로그인상태',isLogIn)
},);

const getAccessToken = async (authorizationCode) => {
// ! 구글 로그인
Expand Down
2 changes: 1 addition & 1 deletion src/WaitingPages/Waiting.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function Waiting({
}, [locationKeys]);
useEffect(() => {
loginCheck(isLogIn);
});
},[]);

return (
<div>
Expand Down

0 comments on commit 17bfe8a

Please sign in to comment.