Skip to content

Commit

Permalink
Merge pull request #15 from Team-B1ND/fix/#14
Browse files Browse the repository at this point in the history
 chore :: ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” api ์‚ญ์ œ
  • Loading branch information
wjzlskxk authored Jul 16, 2024
2 parents dc9dd93 + d836f14 commit bb8e230
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 74 deletions.
1 change: 0 additions & 1 deletion src/components/common/FallbackSkeleton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const FallbackSkeleton = () => {
<SkeletonItem />
))}
</SkeletonContainer>
;
</>
);
};
Expand Down
24 changes: 3 additions & 21 deletions src/hooks/schedule/useCalendearMove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,23 @@ import ToastUIReactCalendar from "@toast-ui/react-calendar/*";
import dayjs from "dayjs";
import { createRef, useCallback } from "react";
import { useRecoilState } from "recoil";
import { usePostModuleLog } from "../../queries/log/log.query";
import { scheduleDateAtom } from "../../store/schedule/schedule.store";
import dateTransform from "../../util/transform/dateTransform";

const useCalendearMove = () => {
const calendarRef = createRef<ToastUIReactCalendar>();
const [date, setDate] = useRecoilState(scheduleDateAtom);

const postModuleLogMutation = usePostModuleLog();

const nextMonth = useCallback(() => {
const calendarInstance = calendarRef!.current!.getInstance();
calendarInstance?.next();

setDate((prev) => {
const nextMonth = dayjs(prev).add(1, "month").format("YYYY-MM-DD");

postModuleLogMutation.mutate({
moduleName: "์ผ์ •/์ผ์ •์กฐํšŒ",
description: `${nextMonth} ์กฐํšŒ`,
});

return nextMonth;
});
}, [calendarRef, setDate, postModuleLogMutation]);
}, [calendarRef, setDate]);

const prevMonth = useCallback(() => {
const calendarInstance = calendarRef!.current!.getInstance();
Expand All @@ -35,28 +27,18 @@ const useCalendearMove = () => {
setDate((prev) => {
const prevMonth = dayjs(prev).subtract(1, "month").format("YYYY-MM-DD"); //ํ•œ ๋‹ฌ์ „

postModuleLogMutation.mutate({
moduleName: "์ผ์ •/์ผ์ •์กฐํšŒ",
description: `${prevMonth} ์กฐํšŒ`,
});

return prevMonth;
});
}, [calendarRef, setDate, postModuleLogMutation]);
}, [calendarRef, setDate]);

const todayMonth = useCallback(() => {
const calendarInstance = calendarRef!.current!.getInstance();
calendarInstance?.today();

const today = `${dateTransform.hyphen().slice(0, 8)}01`;

postModuleLogMutation.mutate({
moduleName: "์ผ์ •/์ผ์ •์กฐํšŒ",
description: `${today} ์กฐํšŒ`,
});

setDate(today);
}, [calendarRef, setDate, postModuleLogMutation]);
}, [calendarRef, setDate]);

return {
date,
Expand Down
24 changes: 5 additions & 19 deletions src/hooks/schedule/useHomeSidebarSchedule.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import dayjs from "dayjs";
import { useEffect, useState } from "react";
import { useRecoilValue } from "recoil";
import { usePostModuleLog } from "../../queries/log/log.query";
import { useGetMember } from "../../queries/member/member.query";
import { useGetSchedulesByDate } from "../../queries/schedule/schedule.query";
import {
scheduleClassificationKeyword,
scheduleDateAtom,
} from "../../store/schedule/schedule.store";
import { scheduleClassificationKeyword, scheduleDateAtom } from "../../store/schedule/schedule.store";
import { Schedule } from "../../types/schedule/schedule.type";

const useHomeSidebarSchedule = () => {
Expand All @@ -21,31 +17,21 @@ const useHomeSidebarSchedule = () => {
startDate: date,
endDate: `${date.slice(0, 8)}${dayjs(date).daysInMonth()}`,
},
{ suspense: true }
{ suspense: true },
);

const postModuleLogMutation = usePostModuleLog();

const loadMyGradeSchedules = () => {
setSchedules(
schedulesData?.data.filter(
(schedule) =>
schedule.targetGrades[0].indexOf(String(memberData?.data.classroom.grade)) >
-1 || schedule.targetGrades[0] === "์ „๊ต์ƒ"
)!
schedule.targetGrades[0].indexOf(String(memberData?.data.classroom.grade)) > -1 ||
schedule.targetGrades[0] === "์ „๊ต์ƒ",
)!,
);
postModuleLogMutation.mutate({
moduleName: "์ผ์ •/๋‚ด์ผ์ • ์กฐํšŒ",
description: "๋‚ด์ผ์ • ์กฐํšŒ",
});
};

const loadAllSchedules = () => {
setSchedules(schedulesData!.data);
postModuleLogMutation.mutate({
moduleName: "์ผ์ •/์ „์ฒด์ผ์ • ์กฐํšŒ",
description: "์ „์ฒด์ผ์ • ์กฐํšŒ",
});
};

const handleSchedules = (scope: string) => {
Expand Down
12 changes: 0 additions & 12 deletions src/queries/log/log.query.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/repository/log/loe.param.ts

This file was deleted.

17 changes: 0 additions & 17 deletions src/repository/log/log.repository.ts

This file was deleted.

0 comments on commit bb8e230

Please sign in to comment.