-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 소셜 로그인 기능 및 회원가입 구현 #102
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
df08aca
refact: env의 BaseURL 사용하도록 수정
hyeeuncho 523fb6d
refact: 로그인 후 LoginModal 닫기
hyeeuncho c391afd
feat: 로그인 후 유저 정보 api 연동 & 전화번호 입력받아 정보 수정 api 연동
hyeeuncho 11967e9
feat: 메인 페이지 로그인 전/후 구분
hyeeuncho adfe618
fix: 잘못 수정된 BaseURL 수정
hyeeuncho 564a09f
fix: readUser 반환형식 변경
hyeeuncho a8184c4
fix: 신규 로그인 정보 입력 버튼 활성화 오류 수정
hyeeuncho 573f19b
remove: 불필요한 코드 삭제
hyeeuncho a55a710
feat: 로그아웃 구현
hyeeuncho ac8d177
refact: 회원가입 전화번호 형식 변경
hyeeuncho 395817f
feat: 메인화면 로그인 구분
hyeeuncho 8f13ecd
fix: ubuntu 버전 업데이트
hyeeuncho ad8f262
fix: 제어 컴포넌트와 react-hook-form 혼합 사용 문제 해결
hyeeuncho 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
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,12 @@ | ||
| import { axiosClient } from "../../../shared/types/api/http-client" | ||
| import { UserInfoRequest, UserInfoResponse } from "../model/userInformation"; | ||
|
|
||
| export const readUser = async (): Promise<UserInfoResponse> => { | ||
| const response = await axiosClient.get<{ result: UserInfoResponse }>('/users'); | ||
| return response.data.result; | ||
| } | ||
hyeeuncho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export const updateUser = async(data: UserInfoRequest): Promise<UserInfoResponse> => { | ||
| const response = await axiosClient.put<UserInfoResponse>('/users', data); | ||
| return response.data; | ||
| } | ||
Yejiin21 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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,16 @@ | ||
| import { useMutation, useQuery } from '@tanstack/react-query'; | ||
| import { readUser, updateUser } from '../api/user'; | ||
| import { UserInfoRequest, UserInfoResponse } from '../model/userInformation'; | ||
|
|
||
| export const useUserInfo = () => { | ||
| return useQuery<UserInfoResponse>({ | ||
| queryKey: ['userInfo'], | ||
| queryFn: readUser, | ||
| }); | ||
| }; | ||
|
|
||
| export const useUserUpdate = () => { | ||
| return useMutation<UserInfoResponse, Error, UserInfoRequest>({ | ||
| mutationFn: updateUser, | ||
| }); | ||
| } |
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,13 @@ | ||
| export interface UserInfoResponse { | ||
| id: number; | ||
| name: string; | ||
| phoneNumber: string; | ||
| email: string; | ||
| } | ||
|
|
||
| export interface UserInfoRequest { | ||
| id: number; | ||
| name: string; | ||
| phoneNumber: string; | ||
| email: string; | ||
| } |
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 |
|---|---|---|
|
|
@@ -47,7 +47,7 @@ const EventDetailsPage = () => { | |
| const [clickedLike, setClickedLike] = useState(false); | ||
|
|
||
| const [event, setEvent] = useState<ReadEvent | null>(null); | ||
| const eventId = 1; //수정 필요 | ||
| const eventId = 21; //수정 필요 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 하드코딩된 이벤트 ID에 대한 수정 필요 현재 이벤트 ID가 하드코딩되어 있고 주석에도 '수정 필요'라고 표시되어 있습니다. 실제 프로덕션 환경에서는 URL 파라미터나 상태 관리를 통해 동적으로 eventId를 받아오는 것이 좋습니다. 다음과 같이 URL에서 동적으로 ID를 받아오는 방식을 고려해보세요: - const eventId = 21; //수정 필요
+ const { eventId } = useParams<{ eventId: string }>();
+ const numericEventId = eventId ? parseInt(eventId, 10) : undefined;이 경우 Router 설정도 수정해야 합니다. 또한 API 호출 시 eventId가 undefined일 경우의 예외 처리도 필요합니다. |
||
|
|
||
| const handleShareClick = (title: string) => { | ||
| setTitle(title); | ||
|
|
||
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,37 @@ | ||
| import { useNavigate, useSearchParams } from "react-router-dom"; | ||
| import useAuthStore from "../../app/provider/authStore"; | ||
| import { useEffect } from "react"; | ||
| import { useUserInfo } from "../../features/join/hooks/useUserHook"; | ||
|
|
||
| const AuthCallback = () => { | ||
| const navigate = useNavigate(); | ||
| const [searchParams] = useSearchParams(); | ||
| const status = searchParams.get('status'); // 'new' or 'existing' | ||
| const { login, setName, isModalOpen } = useAuthStore(); | ||
| const { data } = useUserInfo(); | ||
|
|
||
| useEffect(() => { | ||
| const handleAuth = async () => { | ||
| try { | ||
| if (status === 'new') { | ||
| navigate('/join/agreement'); | ||
| } else { | ||
| login(); | ||
| setName(data?.name || "사용자"); | ||
| console.log(isModalOpen); | ||
| navigate('/'); | ||
| } | ||
| } catch (error) { | ||
| console.error('인증 처리 실패', error); | ||
| navigate('/'); | ||
| } | ||
| }; | ||
| handleAuth(); | ||
| }, [data, navigate, login, status, setName, isModalOpen]); | ||
|
|
||
| return <div className="text-center mt-32 text-lg font-bold">로그인 중입니다...</div>; | ||
| }; | ||
|
|
||
| export default AuthCallback; | ||
|
|
||
|
|
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,24 @@ | ||
| import { useEffect } from 'react'; | ||
| import { useNavigate } from 'react-router-dom'; | ||
| import { axiosClient } from '../../shared/types/api/http-client'; | ||
|
|
||
| const LogoutPage = () => { | ||
| const navigate = useNavigate(); | ||
|
|
||
| useEffect(() => { | ||
| const logout = async () => { | ||
| try { | ||
| await axiosClient.post('/oauth/logout'); | ||
| navigate('/'); | ||
| } catch (error) { | ||
| console.error('로그아웃 실패:', error); | ||
| alert('로그아웃에 실패했습니다. 다시 시도해주세요.'); | ||
| } | ||
| }; | ||
| logout(); | ||
| }, [navigate]); | ||
hyeeuncho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return <div>로그아웃 중...</div>; | ||
| }; | ||
|
|
||
| export default LogoutPage; | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.