Skip to content

Commit

Permalink
fix/function-async
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwonh423 committed Aug 14, 2023
1 parent 42d7b82 commit a9e9c05
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frontend/src/pages/KaKaoRedirectPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import useNavigator from '../hooks/useNavigator';
import { LoginResponse } from '../types/Login';

export const handleOAuthKakao = async (code: string) => {
console.log('hi');
const { routePage } = useNavigator();
console.log('bye');
try {
console.log('222');
const url = `https://mapbefine.kro.kr/oauth/login/kakao?code=${code}`;
console.log('line12');
const data = await getApi<LoginResponse>('login', url);
Expand All @@ -25,13 +28,18 @@ export const handleOAuthKakao = async (code: string) => {
const KakaoRedirectPage = () => {
const location = useLocation();
console.log('location', location);

useEffect(() => {
const searchParams = new URLSearchParams(location.search);
const code = searchParams.get('code');
console.log('code', code);
const ab = async (code: string) => {
await handleOAuthKakao(code);
};
if (code) {
console.log('ifCode', code);
handleOAuthKakao(code);
ab(code);
console.log('ab');
}
}, [location]);

Expand Down

0 comments on commit a9e9c05

Please sign in to comment.