|
1 | | -import { getKakaoLogin } from '@/apis/auth'; |
| 1 | +// import { getKakaoLogin } from '@/apis/auth'; |
2 | 2 | import Loading from '@/components/loading/Loading'; |
3 | | -import { useAuthStore } from '@/store/authStore'; |
| 3 | +// import { useAuthStore } from '@/store/authStore'; |
4 | 4 | import { useEffect } from 'react'; |
5 | | -import { useNavigate } from 'react-router'; |
| 5 | +// import { useNavigate } from 'react-router'; |
6 | 6 |
|
7 | 7 | function KaKaoRedirection() { |
8 | | - const navigate = useNavigate(); |
| 8 | + // const navigate = useNavigate(); |
9 | 9 | const kakaoCode = new URL(window.location.href).searchParams.get('code'); |
10 | | - const { setAccessToken } = useAuthStore(); |
| 10 | + // const { setAccessToken } = useAuthStore(); |
11 | 11 |
|
12 | | - const handleKaKaoLogin = async () => { |
13 | | - try { |
14 | | - console.log('kakaoCode', kakaoCode); |
15 | | - const { code, data } = await getKakaoLogin(kakaoCode as string); |
16 | | - if (code === 200) { |
17 | | - setAccessToken(data.accessToken); |
18 | | - navigate('/home'); |
19 | | - } else { |
20 | | - throw new Error('로그인 에러'); |
21 | | - } |
22 | | - } catch (error) { |
23 | | - console.error('로그인 에러가 발생했습니다.'); |
24 | | - } |
25 | | - }; |
| 12 | + // const handleKaKaoLogin = async () => { |
| 13 | + // try { |
| 14 | + // console.log('kakaoCode', kakaoCode); |
| 15 | + // const { code, data } = await getKakaoLogin(kakaoCode as string); |
| 16 | + // if (code === 200) { |
| 17 | + // setAccessToken(data.accessToken); |
| 18 | + // navigate('/home'); |
| 19 | + // } else { |
| 20 | + // throw new Error('로그인 에러'); |
| 21 | + // } |
| 22 | + // } catch (error) { |
| 23 | + // console.error('로그인 에러가 발생했습니다.'); |
| 24 | + // } |
| 25 | + // }; |
26 | 26 |
|
27 | 27 | useEffect(() => { |
28 | | - if (kakaoCode) handleKaKaoLogin(); |
| 28 | + if (kakaoCode) { |
| 29 | + console.log('🔴 kakaoCode', kakaoCode); |
| 30 | + // handleKaKaoLogin(); |
| 31 | + } |
29 | 32 | }, []); |
30 | 33 | return <Loading />; |
31 | 34 | } |
|
0 commit comments