Skip to content
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

FE-66 🔀 회원가입 페이지 머지 요청 #72

Merged
merged 37 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
74648e7
:lipstick: 회원가입 페이지 레이아웃 추가
jangmoonwon Jul 17, 2024
8a437d1
:lipstick: 간편 로그인 로고 추가
jangmoonwon Jul 17, 2024
9537b85
:lipstick: 회원가입 ui 추가
jangmoonwon Jul 17, 2024
61098fb
Merge pull request #37 from epigram5-9/feat/FE-67
jangmoonwon Jul 18, 2024
eb34b5d
:sparkles: 회원가입 스키마 정의
jangmoonwon Jul 18, 2024
eaaf1cc
:heavy_plus_sign: 회원가입 페이지에 스키마 적용
jangmoonwon Jul 18, 2024
dfb693a
:lipstick: 에러 메시지 뜰 때 라벨, 인풋도 같은 에러 색깔 추가
jangmoonwon Jul 18, 2024
c1305fc
:memo: 유효성 검사를 통한 버튼의 비활성화 처리
jangmoonwon Jul 18, 2024
91e1fff
:memo: 유효성 검사에 따른 인풋 테두리 색상 처리
jangmoonwon Jul 18, 2024
03d62c5
Merge pull request #40 from epigram5-9/feat/FE-68
jangmoonwon Jul 19, 2024
bfd7d3b
:fire: AuthLayout 삭제
jangmoonwon Jul 19, 2024
467a76c
:art: 회원가입 페이지 브라우저 확대시 ui 깨짐 수정
jangmoonwon Jul 19, 2024
bd48061
:truck: 정규표현식 네이밍 변경
jangmoonwon Jul 19, 2024
1256f61
Merge pull request #48 from epigram5-9/fix/FE-66
jangmoonwon Jul 20, 2024
c3b2e06
:twisted_rightwards_arrows: Merge branch 'epic/FE-66' into merge/FE-66
jangmoonwon Jul 22, 2024
36f4b58
Merge pull request #55 from epigram5-9/merge/FE-66
jangmoonwon Jul 22, 2024
70d45e4
:sparkles: 회원가입 응답 데이터 스키마 정의
jangmoonwon Jul 23, 2024
f79b702
:sparkles: 회원가입 api 생성
jangmoonwon Jul 23, 2024
8ba0103
:sparkles: useRegisterMutation hook 생성
jangmoonwon Jul 23, 2024
e5efa3e
:zap: 회원가입 폼에 mutaion hook 적용
jangmoonwon Jul 23, 2024
ca394cc
:sparkles: Toaster 컴포넌트 추가
jangmoonwon Jul 23, 2024
4e9e01a
:sparkles: toast로 에러메시지 띄우기
jangmoonwon Jul 23, 2024
ea2264f
:zap: isAxiosError로 변경
jangmoonwon Jul 24, 2024
8a35cf2
Merge pull request #69 from epigram5-9/fix/FE-69
jangmoonwon Jul 24, 2024
a367f41
Merge pull request #59 from epigram5-9/feat/FE-69
jangmoonwon Jul 25, 2024
7c1f9c4
:twisted_rightwards_arrows: 메인 pr 최신화 및 confiict 수정
jangmoonwon Jul 26, 2024
5785703
:twisted_rightwards_arrows: 충돌 해결
jangmoonwon Jul 26, 2024
a715986
Merge branch 'epic/FE-66' into merge/FE-66
jangmoonwon Jul 26, 2024
9715918
:bug: postSignup 함수 추가
jangmoonwon Jul 26, 2024
0762f98
:bug: postSignin 내보내는 방식 수정
jangmoonwon Jul 26, 2024
a45fdf4
:twisted_rightwards_arrows: conflict 수정
jangmoonwon Jul 26, 2024
7e4eba6
:wrench: lint 수정
jangmoonwon Jul 26, 2024
b5227f6
Merge pull request #74 from epigram5-9/merge/FE-66
jangmoonwon Jul 26, 2024
912b9ef
:twisted_rightwards_arrows: Merge branch 'epic/FE-66' into merge/FE-66
jangmoonwon Jul 27, 2024
ceaaeec
Merge pull request #87 from epigram5-9/merge/FE-66
jangmoonwon Jul 27, 2024
192e06e
:recycle: 에러처리 로직 수정
jangmoonwon Jul 28, 2024
3322aaa
Merge pull request #95 from epigram5-9/fix/FE-66
jangmoonwon Jul 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions public/lg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions public/logo-google.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions public/logo-kakao.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/logo-naver.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/apis/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { PostSignUpRequestType, PostAuthResponseType } from '@/schema/auth';
import httpClient from '.';

// TODO: signin, signup 단어가 비슷해 login, register로 바꿀 예정

const postSignup = async (request: PostSignUpRequestType): Promise<PostAuthResponseType> => {
const response = await httpClient.post('/auth/signUp', request);
return response.data;
};

export default postSignup;
52 changes: 52 additions & 0 deletions src/hooks/useRegisterMutation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import postSignup from '@/apis/auth';
import { toast } from '@/components/ui/use-toast';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
import { isAxiosError } from 'axios';

const useRegisterMutation = () => {
const router = useRouter();

return useMutation({
mutationFn: postSignup,
onSuccess: (data) => {
localStorage.setItem('accessToken', data.accessToken);
localStorage.setItem('refreshToken', data.refreshToken);
router.push('/');
},
onError: (error) => {
if (!isAxiosError(error)) {
toast({
description: '네트워크 오류가 발생했습니다. 인터넷 연결을 확인해주세요.',
className: 'border-state-error text-state-error font-semibold',
});
return;
}

const { status } = error.response || {};

if (status === 400) {
toast({
description: '이미 사용중인 이메일입니다.',
className: 'border-state-error text-state-error font-semibold',
});
return;
}

if (status === 500) {
toast({
description: '이미 존재하는 닉네임입니다.',
className: 'border-state-error text-state-error font-semibold',
});
return;
jangmoonwon marked this conversation as resolved.
Show resolved Hide resolved
}

toast({
description: '알 수 없는 오류가 발생했습니다. 잠시 후 다시 시도해주세요.',
className: 'border-state-error text-state-error font-semibold',
});
},
});
};

export default useRegisterMutation;
2 changes: 2 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import '@/styles/globals.css';
import type { AppProps } from 'next/app';
import { HydrationBoundary, QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import Toaster from '@/components/ui/toaster';

export default function App({ Component, pageProps }: AppProps) {
const [queryClient] = React.useState(() => new QueryClient());
return (
<QueryClientProvider client={queryClient}>
<HydrationBoundary state={pageProps.dehydratedState}>
<Component {...pageProps} />
<Toaster />
</HydrationBoundary>
<ReactQueryDevtools />
</QueryClientProvider>
Expand Down
Loading
Loading