diff --git a/apps/admin/apis/auth/dashboardApi.ts b/apps/admin/apis/auth/dashboardApi.ts index 2e42a4ba..6dfd27b6 100644 --- a/apps/admin/apis/auth/dashboardApi.ts +++ b/apps/admin/apis/auth/dashboardApi.ts @@ -1,8 +1,7 @@ import { fetcher } from "@wow-class/utils"; -import { apiPath, mentorApiPath } from "constants/apiPath"; +import { apiPath } from "constants/apiPath"; import { tags } from "constants/tags"; import type { DashboardApiResponseDto } from "types/dtos/auth"; -import type { MyStudyListApiResponseDto } from "types/dtos/studyList"; export const dashboardApi = { getDashboardInfo: async () => { @@ -19,14 +18,4 @@ export const dashboardApi = { return { studyRole, manageRole }; }, - getMyStudyList: async () => { - const response = await fetcher.get( - mentorApiPath.studyList, - { - next: { tags: [tags.dashboard] }, - cache: "force-cache", - } - ); - return response.data; - }, }; diff --git a/apps/admin/apis/study/studyApi.ts b/apps/admin/apis/study/studyApi.ts index c849ed96..7105f882 100644 --- a/apps/admin/apis/study/studyApi.ts +++ b/apps/admin/apis/study/studyApi.ts @@ -24,6 +24,16 @@ export const studyApi = { return response.data; }, + getMyStudyList: async () => { + const response = await fetcher.get( + mentorApiPath.studyList, + { + next: { tags: [tags.myStudyList] }, + cache: "force-cache", + } + ); + return response.data; + }, getStudyBasicInfo: async (studyId: number) => { const response = await fetcher.get( `/common/studies/${studyId}`, diff --git a/apps/admin/app/studies/_components/StudyList.tsx b/apps/admin/app/studies/_components/StudyList.tsx index f3cbccb7..d4aaf86d 100644 --- a/apps/admin/app/studies/_components/StudyList.tsx +++ b/apps/admin/app/studies/_components/StudyList.tsx @@ -1,11 +1,15 @@ import { css } from "@styled-system/css"; import { studyApi } from "apis/study/studyApi"; +import isAdmin from "utils/isAdmin"; import EmptyStudyList from "./EmptyStudyList"; import StudyListItem from "./StudyListItem"; const StudyList = async () => { - const studyList = await studyApi.getStudyList(); + const adminStatus = await isAdmin(); + const studyList = adminStatus + ? await studyApi.getStudyList() + : await studyApi.getMyStudyList(); if (studyList?.length === 0) { return ; diff --git a/apps/admin/app/studies/create-study/@modal/(.)created-study-check/page.tsx b/apps/admin/app/studies/create-study/@modal/(.)created-study-check/page.tsx index 4b2bcbbe..b1590c0f 100644 --- a/apps/admin/app/studies/create-study/@modal/(.)created-study-check/page.tsx +++ b/apps/admin/app/studies/create-study/@modal/(.)created-study-check/page.tsx @@ -31,6 +31,7 @@ const CreatedStudyCheckModal = () => { if (result.success) { await revalidateTagByName(tags.studyList); + await revalidateTagByName(tags.myStudyList); window.alert("스터디 생성에 성공했어요."); router.push(`${routerPath.root.href}`); } else { diff --git a/apps/admin/app/studies/create-study/_components/StudyBasicInformation/StudyStartDatePick.tsx b/apps/admin/app/studies/create-study/_components/StudyBasicInformation/StudyStartDatePick.tsx index d592ecd7..2cd3e410 100644 --- a/apps/admin/app/studies/create-study/_components/StudyBasicInformation/StudyStartDatePick.tsx +++ b/apps/admin/app/studies/create-study/_components/StudyBasicInformation/StudyStartDatePick.tsx @@ -61,21 +61,6 @@ const StudyStartDatePick = () => { } }, [handleStudyDateSelect, studyDate.fromValue, studyDate.toValue, week]); - const disableDateList = [ - { - from: new Date(0), - to: yesterday, - }, - ...(watch("applicationEndDate") - ? [ - { - from: new Date(0), - to: studyApplyEndDate, - }, - ] - : []), - ]; - return ( @@ -115,9 +100,12 @@ const StudyStartDatePick = () => { {isOpen && (
{ - const studyList = (await isAdmin()) + const adminStatus = await isAdmin(); + const studyList = adminStatus ? await studyApi.getStudyList() - : await dashboardApi.getMyStudyList(); + : await studyApi.getMyStudyList(); const navMenu = [ { diff --git a/apps/admin/constants/tags.ts b/apps/admin/constants/tags.ts index f5c8ad68..268bf0de 100644 --- a/apps/admin/constants/tags.ts +++ b/apps/admin/constants/tags.ts @@ -3,6 +3,7 @@ export const enum tags { assignments = "assignments", curriculums = "curriculums", studyList = "studyList", + myStudyList = "myStudyList", studyBasicInfo = "studyBasicInfo", announcements = "announcements", memberList = "memberList", diff --git a/apps/admin/types/dtos/studyList.ts b/apps/admin/types/dtos/studyList.ts index 26fb683e..768ed939 100644 --- a/apps/admin/types/dtos/studyList.ts +++ b/apps/admin/types/dtos/studyList.ts @@ -1,9 +1,5 @@ import type { DayOfWeekType } from "types/entities/dayofweek"; -import type { - StudyKoreanType, - StudySemesterType, - StudyType, -} from "types/entities/study"; +import type { StudyKoreanType, StudySemesterType } from "types/entities/study"; import type { TimeType } from "types/entities/time"; export interface StudyListApiResponseDto { @@ -20,12 +16,3 @@ export interface StudyListApiResponseDto { totalWeek: number; openingDate: string; } - -export interface MyStudyListApiResponseDto { - studyId: number; - semester: string; - title: string; - studyType: StudyType; - notionLink: string; - mentorName: string; -}