From b23b58e680d1023a17503b384abfd4c61aeadb83 Mon Sep 17 00:00:00 2001 From: Hyang-Dan Date: Wed, 10 Dec 2025 20:56:40 +0900 Subject: [PATCH] =?UTF-8?q?issue=20#60=20-=20=EC=9D=BC=EC=A0=95=20?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/response/index.ts | 1 + .../response/schedule/ScheduleListResponse.ts | 17 +++++++++++++++++ src/network/ScheduleNetwork.ts | 7 +++++-- .../schedule/content/ScheduleListContent.tsx | 14 +++++++++----- 4 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 src/data/response/schedule/ScheduleListResponse.ts diff --git a/src/data/response/index.ts b/src/data/response/index.ts index 880e3e0..18c87a4 100644 --- a/src/data/response/index.ts +++ b/src/data/response/index.ts @@ -9,3 +9,4 @@ export * from './account/ResetPasswordResponse'; export * from './schedule/CreateScheduleResponse'; export * from './schedule/UpdateScheduleResponse'; +export * from './schedule/ScheduleListResponse'; \ No newline at end of file diff --git a/src/data/response/schedule/ScheduleListResponse.ts b/src/data/response/schedule/ScheduleListResponse.ts new file mode 100644 index 0000000..13a2512 --- /dev/null +++ b/src/data/response/schedule/ScheduleListResponse.ts @@ -0,0 +1,17 @@ +import type { ScheduleType } from "@/const/schedule/ScheduleType"; +import { BaseResponse } from "../BaseResponse"; +import type { ScheduleStatus } from "@/const/schedule/ScheduleStatus"; + +export class ScheduleListData { + name!: string; + id!: string; + startDate!: string; + endDate!: string; + type!: string; + style!: string; + status!: string; +} + +export class ScheduleListResponse extends BaseResponse { + data?: ScheduleListData[]; +} \ No newline at end of file diff --git a/src/network/ScheduleNetwork.ts b/src/network/ScheduleNetwork.ts index 1711ca0..989287e 100644 --- a/src/network/ScheduleNetwork.ts +++ b/src/network/ScheduleNetwork.ts @@ -5,13 +5,16 @@ import { UpdateScheduleRequest, DeleteScheduleRequest } from '@/data/request'; -import { CreateScheduleResponse } from "@/data/response"; +import { + CreateScheduleResponse, + ScheduleListResponse +} from "@/data/response"; export class ScheduleNetwork extends BaseNetwork { private baseUrl = "/schedule"; async getList(data: ScheduleListRequest) { - return await this.post( + return await this.post( this.baseUrl, data ); diff --git a/src/ui/component/popover/schedule/content/ScheduleListContent.tsx b/src/ui/component/popover/schedule/content/ScheduleListContent.tsx index 18d10e2..5468974 100644 --- a/src/ui/component/popover/schedule/content/ScheduleListContent.tsx +++ b/src/ui/component/popover/schedule/content/ScheduleListContent.tsx @@ -10,11 +10,11 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { ScheduleNetwork } from "@/network/ScheduleNetwork"; import type { ScheduleStatus } from "@/const/schedule/ScheduleStatus"; import type { ScheduleType } from "@/const/schedule/ScheduleType"; +import { ScheduleListData } from "@/data/response"; export const ScheduleListContent = ({ date, setMode, popoverAlign, popoverSide, open }: ScheduleListContentProps) => { const [isLoading, setIsLoading] = useState(false); - const [scheduleList, setScheduleList] = useState([]); - const [filteredList, setFilteredList] = useState([]); + const [scheduleList, setScheduleList] = useState>([]); const scheduleNetwork = new ScheduleNetwork(); const listScheduleForm = useForm>({ @@ -39,9 +39,10 @@ export const ScheduleListContent = ({ date, setMode, popoverAlign, popoverSide, } = listScheduleForm.watch(); useEffect(() => { - if (isLoading) { + if (isLoading || !open) { return; } + reqList(); return (() => { setIsLoading(false); @@ -51,8 +52,8 @@ export const ScheduleListContent = ({ date, setMode, popoverAlign, popoverSide, const reqList = async () => { const data = { name, - startDate, - endDate, + startDate: date, + endDate: date, status: status as ScheduleStatus | undefined, styleList, typeList: typeList as ScheduleType[] | undefined @@ -60,6 +61,9 @@ export const ScheduleListContent = ({ date, setMode, popoverAlign, popoverSide, const result = await scheduleNetwork.getList(data); + if (result.data.success) { + setScheduleList(result.data.data!); + } } return (