From 5b22519d25b30905e8eb62169d7b4465d1f467f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EB=AF=BC=EC=A3=BC?= Date: Tue, 5 Aug 2025 17:10:40 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=8A=A4=ED=84=B0=EB=94=94=20=EC=B0=B8?= =?UTF-8?q?=EA=B0=80=20=EC=97=AC=EB=B6=80=20api=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/study/api/get-study-data.ts | 5 ++--- src/features/study/api/types.ts | 6 ------ src/features/study/model/use-study-query.ts | 3 +-- src/features/study/ui/study-card.tsx | 7 +------ 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/features/study/api/get-study-data.ts b/src/features/study/api/get-study-data.ts index 570e7b4e..89f1c674 100644 --- a/src/features/study/api/get-study-data.ts +++ b/src/features/study/api/get-study-data.ts @@ -3,7 +3,6 @@ import type { DailyStudyDetail, GetDailyStudiesParams, GetDailyStudiesResponse, - GetDailyStudyDetailParams2, GetMonthlyCalendarParams, JoinStudyRequest, MonthlyCalendarResponse, @@ -87,10 +86,10 @@ export const postJoinStudy = async (payload: JoinStudyRequest) => { // 스터디 참여 유무 확인 export const getWeeklyParticipation = async ( - params: GetDailyStudyDetailParams2, + studyDate: string, ): Promise => { const res = await axiosInstance.get('/study/week/participation', { - params, + params: { studyDate }, }); return res.data.content; diff --git a/src/features/study/api/types.ts b/src/features/study/api/types.ts index 7dbf0b62..f790661b 100644 --- a/src/features/study/api/types.ts +++ b/src/features/study/api/types.ts @@ -34,12 +34,6 @@ export interface DailyStudyDetail { feedback: string; } -export interface GetDailyStudyDetailParams2 { - year: number; - month: number; - day: number; -} - export interface GetDailyStudiesParams { cursor?: number; pageSize?: number; diff --git a/src/features/study/model/use-study-query.ts b/src/features/study/model/use-study-query.ts index 72afc479..ab782631 100644 --- a/src/features/study/model/use-study-query.ts +++ b/src/features/study/model/use-study-query.ts @@ -11,7 +11,6 @@ import { import { CompleteStudyRequest, GetDailyStudiesParams, - GetDailyStudyDetailParams2, GetMonthlyCalendarParams, JoinStudyRequest, MonthlyCalendarResponse, @@ -19,7 +18,7 @@ import { } from '../api/types'; // 스터디 주간 참여 유무 확인 query -export const useWeeklyParticipation = (params: GetDailyStudyDetailParams2) => { +export const useWeeklyParticipation = (params: string) => { return useQuery({ queryKey: ['weeklyParticipation', params], queryFn: () => getWeeklyParticipation(params), diff --git a/src/features/study/ui/study-card.tsx b/src/features/study/ui/study-card.tsx index 6cb4faa4..2c8d5352 100644 --- a/src/features/study/ui/study-card.tsx +++ b/src/features/study/ui/study-card.tsx @@ -53,18 +53,13 @@ function getWeekly(date: Date): { month: number; week: number } { export default function StudyCard() { const [selectedDate, setSelectedDate] = useState(new Date()); - const params = { - year: selectedDate.getFullYear(), - month: selectedDate.getMonth() + 1, - day: selectedDate.getDate(), - }; const offset = selectedDate.getTimezoneOffset() * 60000; // ms단위라 60000곱해줌 const dateOffset = new Date(selectedDate.getTime() - offset); const studyDate = dateOffset.toISOString().split('T')[0]; - const { data: participationData } = useWeeklyParticipation(params); + const { data: participationData } = useWeeklyParticipation(studyDate); const isParticipate = participationData?.isParticipate ?? false; const { month, week } = getWeekly(selectedDate);