-
Notifications
You must be signed in to change notification settings - Fork 2
✨Feat: 로그인 페이지 구현 #65
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 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
990954d
🗑️remove: gitkeep 삭제
Insung-Jo 06e6a2e
🎨style: 커스텀 스타일 추가
Insung-Jo 33bbfcf
♻️refactor: useAuth 내부 로직 분리 및 상태 관리 개선
Insung-Jo edc091e
✨feat: 로그인 로직 react-query useMutation으로 전환 및 적용
Insung-Jo 54b57ba
🫧modify: import 순서 수정
Insung-Jo 9d0aa93
🎨style: 레이아웃 구현
Insung-Jo 3874b83
✨feat: 로그인 페이지 구현
Insung-Jo 2754f34
Merge branch 'develop' into feature/login_v2
Insung-Jo e1810b0
🫧modify: 에러 처리 변수 제거
Insung-Jo 925f914
🫧modify: 조건부 스타일 변경
Insung-Jo adbba55
🫧modify: 함수 일부 수정
Insung-Jo fdbd6c9
🐛fix: 코드래빗 리뷰 반영
Insung-Jo f40578c
Merge branch 'develop' into feature/login_v2
Insung-Jo 47bf3d6
✨feat: 토스트 반영
Insung-Jo f4bdea9
🐛fix: 코드래빗 리뷰 반영
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| export default function DashboardLayout({ | ||
| children, | ||
| }: { | ||
| children: React.ReactNode | ||
| }) { | ||
| return ( | ||
| <div className="flex min-h-screen w-full items-center justify-center"> | ||
| <div className="flex w-520 flex-col items-center justify-center gap-24 px-12 sm:px-0"> | ||
| {children} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } | ||
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,11 +1,26 @@ | ||
| 'use client' | ||
| import Link from 'next/link' | ||
| import { useEffect, useState } from 'react' | ||
|
|
||
| import AuthLogo from '@/app/features/auth/components/AuthLogo' | ||
| import LoginForm from '@/app/features/auth/components/LoginForm' | ||
|
|
||
| export default function Login() { | ||
| const [mounted, setMounted] = useState(false) | ||
| useEffect(() => setMounted(true), []) | ||
| if (!mounted) { | ||
| return null | ||
| } | ||
| return ( | ||
| <> | ||
| <AuthLogo text="오늘도 만나서 반가워요!" /> | ||
| <LoginForm /> | ||
| <p className="text-16 font-normal"> | ||
| 회원이 아니신가요?{' '} | ||
| <Link className="Text-violet underline" href="/signup"> | ||
| 회원가입하기 | ||
| </Link> | ||
| </p> | ||
Insung-Jo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </> | ||
| ) | ||
| } | ||
Empty file.
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,31 @@ | ||
| import { useMutation } from '@tanstack/react-query' | ||
| import axios from 'axios' | ||
| import { useRouter } from 'next/navigation' | ||
| import { toast } from 'sonner' | ||
|
|
||
| import { login } from '../api/authApi' | ||
| import { LoginRequest, LoginResponse } from '../types/auth.type' | ||
| import { useAuth } from './useAuth' | ||
|
|
||
| export function useLoginMutation() { | ||
| const router = useRouter() | ||
| const { updateAuthState } = useAuth() | ||
|
|
||
| return useMutation<LoginResponse, unknown, LoginRequest>({ | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| mutationFn: login, | ||
| onSuccess: async (response) => { | ||
| updateAuthState(response) | ||
| toast.success('로그인 성공') | ||
| await new Promise((resolve) => setTimeout(resolve, 400)) | ||
| router.push('/mydashboard') | ||
| }, | ||
| onError: (error) => { | ||
| if (axios.isAxiosError(error)) { | ||
| const message = error.response?.data?.message | ||
| toast.error(message ?? '로그인 실패') | ||
| } else { | ||
| toast.error('알 수 없는 에러 발생') | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }) | ||
| } | ||
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
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.