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);