diff --git a/src/views/ApplyPage/apis.ts b/src/views/ApplyPage/apis.ts index 32c06d04..648e4441 100644 --- a/src/views/ApplyPage/apis.ts +++ b/src/views/ApplyPage/apis.ts @@ -22,3 +22,9 @@ export const sendData = async (api: string, formValues: ApplyRequest) => { return res; }; + +export const getDraft = async () => { + const res = await tokenInstance.get('/recruiting-answer/store'); + + return res; +}; diff --git a/src/views/SignedInPage/hooks/useGetDraft.tsx b/src/views/ApplyPage/hooks/useGetDraft.tsx similarity index 90% rename from src/views/SignedInPage/hooks/useGetDraft.tsx rename to src/views/ApplyPage/hooks/useGetDraft.tsx index 69cf1a3a..1ee3f204 100644 --- a/src/views/SignedInPage/hooks/useGetDraft.tsx +++ b/src/views/ApplyPage/hooks/useGetDraft.tsx @@ -2,7 +2,7 @@ import { useQuery } from '@tanstack/react-query'; import { getDraft } from '../apis'; -import type { ApplyResponse } from '../../ApplyPage/types'; +import type { ApplyResponse } from '../types'; import type { ErrorResponse } from '@type/errorResponse'; import type { AxiosError, AxiosResponse } from 'axios'; diff --git a/src/views/ApplyPage/index.tsx b/src/views/ApplyPage/index.tsx index e4c7e076..f7f6c71c 100644 --- a/src/views/ApplyPage/index.tsx +++ b/src/views/ApplyPage/index.tsx @@ -9,7 +9,6 @@ import useScrollToHash from '@hooks/useScrollToHash'; import { DraftDialog, SubmitDialog } from 'views/dialogs'; import NoMore from 'views/ErrorPage/components/NoMore'; import BigLoading from 'views/loadings/BigLoding'; -import useGetDraft from 'views/SignedInPage/hooks/useGetDraft'; import ApplyCategory from './components/ApplyCategory'; import ApplyHeader from './components/ApplyHeader'; @@ -19,6 +18,7 @@ import CommonSection from './components/CommonSection'; import DefaultSection from './components/DefaultSection'; import PartSection from './components/PartSection'; import { SELECT_OPTIONS } from './constant'; +import useGetDraft from './hooks/useGetDraft'; import useGetQuestions from './hooks/useGetQuestions'; import useMutateDraft from './hooks/useMutateDraft'; import useMutateSubmit from './hooks/useMutateSubmit'; diff --git a/src/views/MyPage/apis.ts b/src/views/MyPage/apis.ts deleted file mode 100644 index bdec2f6a..00000000 --- a/src/views/MyPage/apis.ts +++ /dev/null @@ -1,7 +0,0 @@ -import tokenInstance from '@apis/tokenInstance'; - -export const getMyInfo = async () => { - const res = await tokenInstance.get('/recruiting-auth/my'); - - return res; -}; diff --git a/src/views/MyPage/index.tsx b/src/views/MyPage/index.tsx index f9abe2d2..7f89c37e 100644 --- a/src/views/MyPage/index.tsx +++ b/src/views/MyPage/index.tsx @@ -20,11 +20,21 @@ const MyInfoItem = ({ label, value }: { label: string; value?: string | number | ); }; +const StatusButton = ({ label, to, trackingEvent }: { label: string; to: string; trackingEvent: string }) => ( +
  • + {label} + +
  • +); + interface MyPageProps { part?: string; + applicationPass?: boolean; } -const MyPage = ({ part }: MyPageProps) => { +const MyPage = ({ part, applicationPass }: MyPageProps) => { const { recruitingInfo: { name, season }, } = useContext(RecruitingInfoContext); @@ -41,34 +51,24 @@ const MyPage = ({ part }: MyPageProps) => { - {NoMoreScreeningResult && NoMoreFinalResult && } - {(!NoMoreScreeningResult || !NoMoreFinalResult) && ( -
  • - 지원상태 - -
  • + {NoMoreScreeningResult && NoMoreFinalResult && ( + )} - {!NoMoreReview && ( -
  • - 지원서 - -
  • + {!NoMoreScreeningResult && } + {!NoMoreFinalResult && + (applicationPass ? ( + + ) : ( + + ))} + {NoMoreReview ? ( + + ) : ( + )} - {NoMoreReview && } ); diff --git a/src/views/ResultPage/hooks/useGetFinalResult.tsx b/src/views/ResultPage/hooks/useGetFinalResult.tsx index 4f9ec8fc..25e2a98e 100644 --- a/src/views/ResultPage/hooks/useGetFinalResult.tsx +++ b/src/views/ResultPage/hooks/useGetFinalResult.tsx @@ -2,7 +2,7 @@ import { useQuery } from '@tanstack/react-query'; import { getFinalResult } from '../apis'; -import type { FinalResultResponse } from '../../MyPage/types'; +import type { FinalResultResponse } from '../types'; import type { ErrorResponse } from '@type/errorResponse'; import type { AxiosError, AxiosResponse } from 'axios'; diff --git a/src/views/ResultPage/hooks/useGetScreeningResult.tsx b/src/views/ResultPage/hooks/useGetScreeningResult.tsx index 32326365..bb9f87fa 100644 --- a/src/views/ResultPage/hooks/useGetScreeningResult.tsx +++ b/src/views/ResultPage/hooks/useGetScreeningResult.tsx @@ -2,7 +2,7 @@ import { useQuery } from '@tanstack/react-query'; import { getScreeningResult } from '../apis'; -import type { ScreeningResultResponse } from '../../MyPage/types'; +import type { ScreeningResultResponse } from '../types'; import type { ErrorResponse } from '@type/errorResponse'; import type { AxiosError, AxiosResponse } from 'axios'; diff --git a/src/views/MyPage/types.ts b/src/views/ResultPage/types.ts similarity index 61% rename from src/views/MyPage/types.ts rename to src/views/ResultPage/types.ts index 461abc40..3a269f69 100644 --- a/src/views/MyPage/types.ts +++ b/src/views/ResultPage/types.ts @@ -1,18 +1,3 @@ -export interface MyRequest { - email: string; - season: number; - group: string; - password: string; -} - -export interface MyResponse { - err: boolean; - season: number; - name: string; - part: string; - submit: boolean; -} - export interface ScreeningResultResponse { err: boolean; season: number; diff --git a/src/views/ReviewPage/index.tsx b/src/views/ReviewPage/index.tsx index 4c17b938..14c4616a 100644 --- a/src/views/ReviewPage/index.tsx +++ b/src/views/ReviewPage/index.tsx @@ -11,12 +11,12 @@ import BottomSection from 'views/ApplyPage/components/BottomSection'; import CommonSection from 'views/ApplyPage/components/CommonSection'; import DefaultSection from 'views/ApplyPage/components/DefaultSection'; import PartSection from 'views/ApplyPage/components/PartSection'; +import useGetDraft from 'views/ApplyPage/hooks/useGetDraft'; import useGetQuestions from 'views/ApplyPage/hooks/useGetQuestions'; import { container, formContainer } from 'views/ApplyPage/style.css'; import PreventReviewDialog from 'views/dialogs/PreventReviewDialog'; import NoMore from 'views/ErrorPage/components/NoMore'; import BigLoading from 'views/loadings/BigLoding'; -import useGetDraft from 'views/SignedInPage/hooks/useGetDraft'; const ReviewPage = () => { const preventReviewDialog = useRef(null); diff --git a/src/views/SignedInPage/apis.ts b/src/views/SignedInPage/apis.ts index 9339b74b..bdec2f6a 100644 --- a/src/views/SignedInPage/apis.ts +++ b/src/views/SignedInPage/apis.ts @@ -1,7 +1,7 @@ import tokenInstance from '@apis/tokenInstance'; -export const getDraft = async () => { - const res = await tokenInstance.get('/recruiting-answer/store'); +export const getMyInfo = async () => { + const res = await tokenInstance.get('/recruiting-auth/my'); return res; }; diff --git a/src/views/MyPage/hooks/useGetMyInfo.tsx b/src/views/SignedInPage/hooks/useGetMyInfo.tsx similarity index 100% rename from src/views/MyPage/hooks/useGetMyInfo.tsx rename to src/views/SignedInPage/hooks/useGetMyInfo.tsx diff --git a/src/views/SignedInPage/index.tsx b/src/views/SignedInPage/index.tsx index dd72059d..39794be0 100644 --- a/src/views/SignedInPage/index.tsx +++ b/src/views/SignedInPage/index.tsx @@ -5,13 +5,14 @@ import ApplyPage from 'views/ApplyPage'; import CompletePage from 'views/CompletePage'; import BigLoading from 'views/loadings/BigLoding'; import MyPage from 'views/MyPage'; -import useGetMyInfo from 'views/MyPage/hooks/useGetMyInfo'; + +import useGetMyInfo from './hooks/useGetMyInfo'; const SignedInPage = () => { const [isComplete, setIsComplete] = useState(false); const { myInfoData, myInfoIsLoading } = useGetMyInfo(); - const { name, season, part, submit } = myInfoData?.data || {}; + const { name, season, part, submit, applicationPass } = myInfoData?.data || {}; const { handleSaveRecruitingInfo } = useContext(RecruitingInfoContext); @@ -31,7 +32,7 @@ const SignedInPage = () => { return ( <> {isComplete && } - {!isComplete && submit && } + {!isComplete && submit && } {!isComplete && !submit && } ); diff --git a/src/views/SignedInPage/types.ts b/src/views/SignedInPage/types.ts new file mode 100644 index 00000000..7aee9b97 --- /dev/null +++ b/src/views/SignedInPage/types.ts @@ -0,0 +1,16 @@ +export interface MyRequest { + email: string; + season: number; + group: string; + password: string; +} + +export interface MyResponse { + err: boolean; + season: number; + name: string; + part: string; + submit: boolean; + applicationPass: boolean; + finalPass: boolean; +}