-
Notifications
You must be signed in to change notification settings - Fork 5
[FE] feat: kakao oauth 추가 #521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
serin-B
wants to merge
12
commits into
dev-front
Choose a base branch
from
front/test/serin/gg
base: dev-front
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
16299f7
[FE] test: google oauth
serin-B 4c31801
Merge branch 'dev-front' of https://github.com/codestates-seb/seb40_m…
serin-B ff570d8
[FE]test: Oauth 로그인 테스트
serin-B 301fd59
[FE] 카카오톡 리다이렉트 주소 변경
serin-B fbe7e48
[fe] 카카오 리다이렉트 주소 변경
serin-B adb6177
구글 주소 변경
serin-B 0171118
a 링크로 변경
serin-B 3f2dbb5
카카오 리다이렉트 주소 변경
serin-B 55cd9a3
[FE] 카카오oauth 테스트를 위한 최신화
serin-B 8d0ba53
[FE] chore : 문구 변경
serin-B 87bd531
[FE] chore: 콘솔 제거 및 로딩 이미지 추가
serin-B 6f18a02
[FE] style: oauth 버튼 추가
serin-B File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,48 @@ | ||
| import { useEffect } from 'react'; | ||
| import { useDispatch } from 'react-redux'; | ||
| import { useNavigate } from 'react-router-dom'; | ||
| import { oauthAsync } from 'store/modules/authSlice'; | ||
| import { setOpenSnackbar } from 'store/modules/snackbarSlice'; | ||
| import PageContainer from 'containers/PageContainer'; | ||
| import Loading from 'components/Loading'; | ||
|
|
||
| const OauthPage = () => { | ||
| const dispatch = useDispatch(); | ||
| const navigate = useNavigate(); | ||
| useEffect(() => { | ||
| const path = location.pathname; | ||
| const code = location.search; | ||
| getOauthCode(path, code); | ||
| }, []); | ||
|
|
||
| const getOauthCode = (path, code) => { | ||
| dispatch(oauthAsync({ path, code })) | ||
| .unwrap() | ||
| .then(() => { | ||
| dispatch( | ||
| setOpenSnackbar({ | ||
| severity: 'success', | ||
| message: '로그인이 완료되었습니다.', | ||
| }) | ||
| ); | ||
| navigate('/', { replace: true }); | ||
| }) | ||
| .catch((err) => { | ||
| console.log(err); | ||
| dispatch( | ||
| setOpenSnackbar({ | ||
| severity: 'error', | ||
| message: `${err.message}로 인해 로그인 실패하였습니다`, | ||
| }) | ||
| ); | ||
| navigate('/', { replace: true }); | ||
| }); | ||
| }; | ||
| return ( | ||
| <PageContainer> | ||
| <Loading /> | ||
| </PageContainer> | ||
| ); | ||
| }; | ||
|
|
||
| export default OauthPage; |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React.StrictMod 사용하면 안되는 이유가 있나요?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<React.StrictMode> 때문에 get 요청이 2번씩 가더라고요!!
(검색해보니까 프로젝트의 src/index.js에서 <React.StrictMode> 태그로 이 감싸져있으면 개발모드에서 (개발 단계시 오류를 잘 잡기위해) 두 번씩 렌더링된다고 합니다!)
구현 과정에서 get 요청이 두 번 가서 오류가 나는 것 같다고 말씀해주셔서, 주석처리하고 테스트 해보았고, 그 뒤로 잘 되어서 일단 주석처리 하였습니다!
실제 서비스 배포할때에도 영향이 있는지는 조금 더 테스트해봐야할 것 같습니다!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
논의 결과 수정이 필요한 부분으로 보입니다.