-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from FinalDoubleTen/FE-13--feat/NewUser
Feat: 카카오 로그인 구현 / 무한 로그아웃 문제 해결
- Loading branch information
Showing
22 changed files
with
217 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { UserInfoState } from '@recoil/Auth.atom'; | ||
import { setItem } from '@utils/localStorageFun'; | ||
import { useEffect } from 'react'; | ||
import { useNavigate, useSearchParams } from 'react-router-dom'; | ||
import { useSetRecoilState } from 'recoil'; | ||
|
||
const KakaoLogin = () => { | ||
const setUserInfo = useSetRecoilState(UserInfoState); | ||
const navigate = useNavigate(); | ||
|
||
const [searchParams, _] = useSearchParams(); | ||
const nickname = searchParams.get('nickname'); | ||
const email = searchParams.get('email'); | ||
const gender = searchParams.get('gender'); | ||
const age_range = searchParams.get('age_range'); | ||
const accessToken = searchParams.get('token'); | ||
const profile_image = searchParams.get('profile_image'); | ||
const signup = searchParams.get('signup'); | ||
|
||
useEffect(() => { | ||
if (accessToken) { | ||
setItem('accessToken', accessToken); | ||
setUserInfo({ | ||
nickname: nickname!, | ||
email: email!, | ||
profileImageUrl: profile_image, | ||
ageType: age_range, | ||
genderType: gender, | ||
survey: null, | ||
}); | ||
if (signup) { | ||
navigate('/signup/success'); | ||
} else { | ||
navigate('/'); | ||
} | ||
} else { | ||
alert('로그인에 실패했습니다. 다시 시도해주세요.'); | ||
navigate('/login'); | ||
} | ||
}, []); | ||
return <>카카오 로그인 중입니다.</>; | ||
}; | ||
|
||
export default KakaoLogin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import LoginLogo from './LoginLogo'; | ||
import LoginForm from './LoginForm'; | ||
import AuthButtonsWrapper from './AuthButtons/AuthButtonsWrapper'; | ||
import KakaoLogin from './KakaoLogin'; | ||
|
||
export { LoginLogo, LoginForm, AuthButtonsWrapper }; | ||
export { LoginLogo, LoginForm, AuthButtonsWrapper, KakaoLogin }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.