-
Notifications
You must be signed in to change notification settings - Fork 2
✨Feat: 회원가입 페이지 구현 #69
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 all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e786b71
🐛fix: 스웨거 스키마에 맞게 변경
Insung-Jo 79edb5d
✨feat: 회원가입 로직 react-query useMutation으로 전환 및 적용
Insung-Jo d2484fa
♻️refactor: useAuth 내부 로직 분리
Insung-Jo 4dcacba
✨feat: 회원가입 페이지 구현
Insung-Jo d0394d5
🫧 modify: 불필요한 코드 제거
Insung-Jo 28ccba3
✨feat: useMounted 훅 구현 및 적용
Insung-Jo 10c0c86
✨feat: 조건부 렌더링 추가
Insung-Jo e51fbe0
🐛fix: 코드래빗 리뷰 반영
Insung-Jo 9cfab6b
🐛fix: 레이아웃 반응형 수정
Insung-Jo aa01a35
🎨style: 글로벌 스타일 추가 및 변경
Insung-Jo 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,25 @@ | ||
| 'use client' | ||
|
|
||
| import { useMounted } from '@hooks/useMounted' | ||
| import Link from 'next/link' | ||
|
|
||
| import AuthLogo from '@/app/features/auth/components/AuthLogo' | ||
| import SignupForm from '@/app/features/auth/components/SignupForm' | ||
|
|
||
| export default function Signup() { | ||
| const mounted = useMounted() | ||
| if (!mounted) return null | ||
|
|
||
| return ( | ||
| <> | ||
| <AuthLogo text="환영합니다!" /> | ||
| <SignupForm /> | ||
| <p className="text-16 font-normal"> | ||
| 이미 회원이신가요?{' '} | ||
| <Link className="Text-violet underline" href="/login"> | ||
| 로그인 | ||
| </Link> | ||
| </p> | ||
| </> | ||
| ) | ||
| } |
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,34 @@ | ||
| import { showError, showSuccess } from '@lib/toast' | ||
| import { useMutation } from '@tanstack/react-query' | ||
| import type { AxiosError } from 'axios' | ||
| import axios from 'axios' | ||
| import { useRouter } from 'next/navigation' | ||
|
|
||
| import { User } from '@/app/shared/types/user.type' | ||
|
|
||
| import { signup } from '../api/authApi' | ||
| import { SignupRequest } from '../types/auth.type' | ||
|
|
||
| export function useSignupMutation() { | ||
| const router = useRouter() | ||
|
|
||
| return useMutation<User, AxiosError | Error, SignupRequest>({ | ||
| mutationFn: signup, | ||
| onSuccess: async () => { | ||
| showSuccess('회원가입이 완료되었습니다!') | ||
| await new Promise((resolve) => setTimeout(resolve, 400)) | ||
| router.push('/login') | ||
| }, | ||
| onError: (error) => { | ||
| if (axios.isAxiosError(error)) { | ||
| const severMessage = ( | ||
| error.response?.data as { message?: string } | undefined | ||
| )?.message | ||
| const fallback = error.message || '로그인 실패' | ||
| showError(severMessage ?? fallback) | ||
| } else { | ||
| showError('알 수 없는 에러 발생') | ||
| } | ||
| }, | ||
| }) | ||
| } |
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
| import { useEffect, useState } from 'react' | ||
|
|
||
| export function useMounted() { | ||
| const [mounted, setMounted] = useState(false) | ||
|
|
||
| useEffect(() => { | ||
| setMounted(true) | ||
| }, []) | ||
|
|
||
| return mounted | ||
| } | ||
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.
마운트 상태 관리 훅을 따로 만들어주셨군요!!