track('click-signin-signup')}>
- 새 지원서 작성하기
-
+
+
+ 새 지원서 작성하기
+
+
}>
{season}기 {isMakers ? '' : group} 지원서 작성이 처음이라면 ‘새 지원서 작성하기’를 진행해주세요. 이전에
diff --git a/src/views/SignInPage/hooks/useMutateSignIn.tsx b/src/views/SignInPage/hooks/useMutateSignIn.tsx
index 85351fe4..4f2b5ccc 100644
--- a/src/views/SignInPage/hooks/useMutateSignIn.tsx
+++ b/src/views/SignInPage/hooks/useMutateSignIn.tsx
@@ -6,8 +6,7 @@ import { VALIDATION_CHECK } from '@constants/validationCheck';
import { sendSignIn } from '../apis';
import type { SignInRequest, SignInResponse } from '../types';
-import type { ErrorResponse } from '@type/errorResponse';
-import type { AxiosError, AxiosResponse } from 'axios';
+import type { CustomError } from '@apis/fetcher';
interface MutateSignInProps {
finalPassConfirmEnd?: string;
@@ -15,20 +14,16 @@ interface MutateSignInProps {
}
const useMutateSignIn = ({ finalPassConfirmEnd, onSetError }: MutateSignInProps) => {
- const { mutate: signInMutate, isPending: signInIsPending } = useMutation<
- AxiosResponse,
- AxiosError,
- SignInRequest
- >({
+ const { mutate: signInMutate, isPending: signInIsPending } = useMutation({
mutationFn: (userInfo: SignInRequest) => sendSignIn(userInfo),
- onSuccess: ({ data: { email, token } }) => {
+ onSuccess: ({ email, token }) => {
setUserId(email);
localStorage.setItem('soptApplyAccessToken', token);
localStorage.setItem('soptApplyAccessTokenExpiredTime', finalPassConfirmEnd || '');
window.location.reload();
},
onError(error) {
- if (error.response?.status === 403) {
+ if (error.status === 403) {
onSetError('email', 'not-match', VALIDATION_CHECK.email.notMatchErrorText);
onSetError('password', 'not-match', VALIDATION_CHECK.password.notMatchErrorText);
}
diff --git a/src/views/SignInPage/index.tsx b/src/views/SignInPage/index.tsx
index 6222eb9d..dae11867 100644
--- a/src/views/SignInPage/index.tsx
+++ b/src/views/SignInPage/index.tsx
@@ -1,16 +1,17 @@
-import { useContext } from 'react';
+import { lazy } from 'react';
import useDate from '@hooks/useDate';
-import { DeviceTypeContext } from '@store/deviceTypeContext';
-import NoMore from 'views/ErrorPage/components/NoMore';
+import { useDeviceType } from 'contexts/DeviceTypeProvider';
import BigLoading from 'views/loadings/BigLoding';
import SignInForm from './components/SignInForm';
import SignInInfo from './components/SignInInfo';
import { containerVar } from './style.css';
+const NoMore = lazy(() => import('views/ErrorPage/components/NoMore'));
+
const SignInPage = () => {
- const { deviceType } = useContext(DeviceTypeContext);
+ const { deviceType } = useDeviceType();
const { isLoading, NoMoreRecruit, isMakers } = useDate();
if (isLoading) return ;
diff --git a/src/views/SignedInPage/index.tsx b/src/views/SignedInPage/index.tsx
index 6323fb49..25ed7c5a 100644
--- a/src/views/SignedInPage/index.tsx
+++ b/src/views/SignedInPage/index.tsx
@@ -1,7 +1,7 @@
import { track } from '@amplitude/analytics-browser';
-import { useContext, useEffect, useState } from 'react';
+import { useEffect, useState } from 'react';
-import { RecruitingInfoContext } from '@store/recruitingInfoContext';
+import { useRecruitingInfo } from 'contexts/RecruitingInfoProvider';
import ApplyPage from 'views/ApplyPage';
import CompletePage from 'views/CompletePage';
import BigLoading from 'views/loadings/BigLoding';
@@ -15,7 +15,7 @@ const SignedInPage = () => {
const { myInfoData, myInfoIsLoading } = useGetMyInfo();
const { name, season, part, submit, applicationPass } = myInfoData?.data || {};
- const { handleSaveRecruitingInfo } = useContext(RecruitingInfoContext);
+ const { handleSaveRecruitingInfo } = useRecruitingInfo();
const handleSetComplete = () => {
track('done-apply-confirm_submit');
diff --git a/src/views/SignupPage/apis.ts b/src/views/SignupPage/apis.ts
index acae49bc..9803c327 100644
--- a/src/views/SignupPage/apis.ts
+++ b/src/views/SignupPage/apis.ts
@@ -1,17 +1,20 @@
-import instance from '@apis/instance';
+import fetcher from '@apis/fetcher';
import type { SignUpRequest } from './types';
export const sendSignUp = async (userInfo: SignUpRequest) => {
const { email, password, passwordCheck, name, phone, season, group } = userInfo;
- const res = await instance.post('/recruiting-auth/signup', {
- email,
- password,
- passwordCheck,
- name,
- phone,
- season,
- group,
+ const res = await fetcher('/recruiting-auth/signup', {
+ method: 'POST',
+ body: {
+ email,
+ password,
+ passwordCheck,
+ name,
+ phone,
+ season,
+ group,
+ },
});
return res;
diff --git a/src/views/SignupPage/components/SignupForm/index.tsx b/src/views/SignupPage/components/SignupForm/index.tsx
index 56137cb2..d5f96de4 100644
--- a/src/views/SignupPage/components/SignupForm/index.tsx
+++ b/src/views/SignupPage/components/SignupForm/index.tsx
@@ -1,5 +1,4 @@
-import { track } from '@amplitude/analytics-browser';
-import { useContext, useEffect, useRef } from 'react';
+import { lazy, useEffect } from 'react';
import { type FieldValues, FormProvider, useForm } from 'react-hook-form';
import Button from '@components/Button';
@@ -10,17 +9,21 @@ import { TextBox비밀번호, TextBox이름, TextBox이메일 } from '@component
import { PRIVACY_POLICY } from '@constants/policy';
import { VALIDATION_CHECK } from '@constants/validationCheck';
import useVerificationStatus from '@hooks/useVerificationStatus';
-import { RecruitingInfoContext } from '@store/recruitingInfoContext';
-import { ExistingApplicantDialog } from 'views/dialogs';
+import { useRecruitingInfo } from 'contexts/RecruitingInfoProvider';
import useMutateSignUp from 'views/SignupPage/hooks/useMutateSignUp';
import { formWrapper } from './style.css';
+import useDialog from '@hooks/useDialog';
+
+const ExistingApplicantDialog = lazy(() =>
+ import('views/dialogs').then(({ ExistingApplicantDialog }) => ({ default: ExistingApplicantDialog })),
+);
const SignupForm = () => {
const {
recruitingInfo: { season, group },
- } = useContext(RecruitingInfoContext);
- const existingApplicantRef = useRef(null);
+ } = useRecruitingInfo();
+ const { ref: existingApplicantDialogRef, handleShowDialog: handleShowExistingApplicantDialog } = useDialog();
const { isVerified, handleVerified } = useVerificationStatus();
const methods = useForm({ mode: 'onBlur' });
@@ -31,7 +34,7 @@ const SignupForm = () => {
formState: { errors },
} = methods;
const { signUpMutate, signUpIsPending } = useMutateSignUp({
- onCheckExistence: () => existingApplicantRef.current?.showModal(),
+ onCheckExistence: () => handleShowExistingApplicantDialog(),
});
const handleSubmitSignUp = ({ email, password, passwordCheck, name, phone }: FieldValues) => {
@@ -66,7 +69,7 @@ const SignupForm = () => {
return (
<>
-
+