Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 11 additions & 4 deletions apps/web/src/apis/Scores/getGpaList.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import { useQuery } from "@tanstack/react-query";
import { type UseQueryOptions, useQuery } from "@tanstack/react-query";
import type { AxiosResponse } from "axios";

import { ScoresQueryKeys, scoresApi } from "./api";
import { ScoresQueryKeys, scoresApi, type UseMyGpaScoreResponse } from "./api";

type UseGetMyGpaScoreOptions = Omit<
UseQueryOptions<AxiosResponse<UseMyGpaScoreResponse>, unknown, UseMyGpaScoreResponse>,
"queryKey" | "queryFn"
>;

/**
* @description 내 학점 점수 조회 훅
*/
const useGetMyGpaScore = ({ enabled = true }: { enabled?: boolean } = {}) => {
const useGetMyGpaScore = (props?: UseGetMyGpaScoreOptions) => {
return useQuery({
queryKey: [ScoresQueryKeys.myGpaScore],
queryFn: scoresApi.getMyGpaScore,
enabled,
enabled: true,
staleTime: Infinity,
select: (data) => data.data,
...props,
});
};

Expand Down
15 changes: 12 additions & 3 deletions apps/web/src/apis/Scores/getLanguageTestList.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import { useQuery } from "@tanstack/react-query";
import { type UseQueryOptions, useQuery } from "@tanstack/react-query";
import type { AxiosResponse } from "axios";

import { ScoresQueryKeys, scoresApi } from "./api";
import type { LanguageTestScore } from "@/types/score";
import { ScoresQueryKeys, scoresApi, type UseGetMyLanguageTestScoreResponse } from "./api";

type UseGetMyLanguageTestScoreOptions = Omit<
UseQueryOptions<AxiosResponse<UseGetMyLanguageTestScoreResponse>, unknown, LanguageTestScore[]>,
"queryKey" | "queryFn"
>;

/**
* @description 내 어학 점수 조회 훅
*/
const useGetMyLanguageTestScore = () => {
const useGetMyLanguageTestScore = (props?: UseGetMyLanguageTestScoreOptions) => {
return useQuery({
queryKey: [ScoresQueryKeys.myLanguageTestScore],
queryFn: scoresApi.getMyLanguageTestScore,
enabled: true,
staleTime: Infinity,
select: (data) => data.data.languageTestScoreStatusResponseList,
...props,
});
};

Expand Down
16 changes: 14 additions & 2 deletions apps/web/src/apis/applications/api.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import type { AxiosResponse } from "axios";
import type { ApplicationListResponse } from "@/types/application";
import type { ApplicationListResponse, ApplicationPreviewResponse } from "@/types/application";
import { axiosInstance } from "@/utils/axiosInstance";

// ====== Query Keys ======
export const ApplicationsQueryKeys = {
competitorsApplicationList: "competitorsApplicationList",
applicationPreview: "applicationPreview",
} as const;

// ====== Types ======
export interface UseSubmitApplicationResponse {
isSuccess: boolean;
totalApplyCount: number;
applyCount: number;
appliedUniversities: {
choices: string[];
};
}

export interface UseSubmitApplicationRequest {
Expand Down Expand Up @@ -37,6 +42,13 @@ export const applicationsApi = {
return axiosInstance.get("/applications");
},

/**
* 지원자가 있는 대학의 제한 공개 정보 조회
*/
getApplicationPreview: async (): Promise<AxiosResponse<ApplicationPreviewResponse>> => {
return axiosInstance.get("/applications/preview");
},

/**
* 지원 제출
*/
Expand Down
17 changes: 17 additions & 0 deletions apps/web/src/apis/applications/getApplicationPreview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useQuery } from "@tanstack/react-query";
import type { AxiosError } from "axios";
import type { ApplicationPreviewResponse } from "@/types/application";
import { ApplicationsQueryKeys, applicationsApi } from "./api";

const useGetApplicationPreview = () => {
return useQuery<ApplicationPreviewResponse, AxiosError<{ message: string }>>({
queryKey: [ApplicationsQueryKeys.applicationPreview],
queryFn: async () => {
const response = await applicationsApi.getApplicationPreview();
return response.data;
},
staleTime: 1000 * 60 * 5,
});
};

export default useGetApplicationPreview;
1 change: 1 addition & 0 deletions apps/web/src/apis/applications/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export type { UseSubmitApplicationRequest, UseSubmitApplicationResponse } from "./api";
export { ApplicationsQueryKeys, applicationsApi } from "./api";
export { default as useGetApplicationsList } from "./getApplicants";
export { default as useGetApplicationPreview } from "./getApplicationPreview";
export { default as useGetCompetitors } from "./getCompetitors";
export { default as usePostSubmitApplication } from "./postSubmitApplication";
1 change: 1 addition & 0 deletions apps/web/src/app/my/school-email/_lib/returnTo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const SCHOOL_EMAIL_RETURN_PATHS = {
applicationApply: "/university/application/apply",
applicationStatus: "/university/application",
score: "/university/score",
gpaSubmit: "/university/score/submit/gpa",
} as const;
Expand Down
Loading
Loading