Skip to content

Commit

Permalink
fix: 토큰 비동기 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
choisohyun committed Jul 30, 2022
1 parent 64060e9 commit eecf760
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pages/OauthKakao.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ const OauthKakao = () => {
const code = new URL(window.location.href).searchParams.get('code');
const navigate = useNavigate();
useEffect(() => {
initiate();
}, []);

const initiate = async () => {
try {
const data = getToken();
const data = await getToken();
setToken(data);
navigate(Path.AuthMail);
} catch (error) {
console.log(error);
}
}, []);
};

const getToken = async () => {
const response = await client.get(`/oauth/kakao?code=${code}`);
Expand Down

0 comments on commit eecf760

Please sign in to comment.