Skip to content

Commit

Permalink
Merge pull request #199 from Kernel360/page-map-marker
Browse files Browse the repository at this point in the history
페이지 기능: 카카오 인가 코드 페이지 제작
  • Loading branch information
bottlewook authored Feb 21, 2024
2 parents 187fb8b + 3b268ab commit 493cb75
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
39 changes: 39 additions & 0 deletions src/app/oauth/kakao/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use client';

import { useCallback, useEffect } from 'react';

import { useSearchParams } from 'next/navigation';

import { getRequest } from '@/remote/api/requests/requests.api';

function KakaoPage() {
const searchParams = useSearchParams();
const code = searchParams.get('code');
/* eslint-disable no-console */
console.log(code);

const loginHandler = useCallback(
async (authCode: string) => {
// 백엔드에 전송
const response = await getRequest('/member/login/forKakao', {
method: 'get',
headers: {
Authorization: authCode,
},
});

return response;
},
[],
);

useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
loginHandler(code!);
}, [code, loginHandler]);
return (
<div />
);
}

export default KakaoPage;
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function KakaoLoginButton() {

return (
<>
<button type="button" onClick={handleLoginKakao}>
<button type="button" onClick={handleLoginKakao} style={{ cursor: 'pointer' }}>
<Image src="/assets/kakaoLoginButton.png" alt="카카오 로그인 버튼" width={40} height={40} />
</button>
<KakaoScript />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Image from 'next/image';

function NaverLoginButton() {
return (
<button type="button">
<button type="button" style={{ cursor: 'pointer' }}>
<Image src="/assets/naverLoginButton.png" alt="네이버 로그인" width={40} height={40} />
</button>
);
Expand Down

0 comments on commit 493cb75

Please sign in to comment.