issue #60
All checks were successful
Test CI / build (push) Successful in 17s

- 일정 목록 조회 기능 구현 중
This commit is contained in:
2025-12-10 20:56:40 +09:00
parent e86fb3bac2
commit b23b58e680
4 changed files with 32 additions and 7 deletions

View File

@@ -9,3 +9,4 @@ export * from './account/ResetPasswordResponse';
export * from './schedule/CreateScheduleResponse'; export * from './schedule/CreateScheduleResponse';
export * from './schedule/UpdateScheduleResponse'; export * from './schedule/UpdateScheduleResponse';
export * from './schedule/ScheduleListResponse';

View File

@@ -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[];
}

View File

@@ -5,13 +5,16 @@ import {
UpdateScheduleRequest, UpdateScheduleRequest,
DeleteScheduleRequest DeleteScheduleRequest
} from '@/data/request'; } from '@/data/request';
import { CreateScheduleResponse } from "@/data/response"; import {
CreateScheduleResponse,
ScheduleListResponse
} from "@/data/response";
export class ScheduleNetwork extends BaseNetwork { export class ScheduleNetwork extends BaseNetwork {
private baseUrl = "/schedule"; private baseUrl = "/schedule";
async getList(data: ScheduleListRequest) { async getList(data: ScheduleListRequest) {
return await this.post( return await this.post<ScheduleListResponse>(
this.baseUrl, this.baseUrl,
data data
); );

View File

@@ -10,11 +10,11 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { ScheduleNetwork } from "@/network/ScheduleNetwork"; import { ScheduleNetwork } from "@/network/ScheduleNetwork";
import type { ScheduleStatus } from "@/const/schedule/ScheduleStatus"; import type { ScheduleStatus } from "@/const/schedule/ScheduleStatus";
import type { ScheduleType } from "@/const/schedule/ScheduleType"; import type { ScheduleType } from "@/const/schedule/ScheduleType";
import { ScheduleListData } from "@/data/response";
export const ScheduleListContent = ({ date, setMode, popoverAlign, popoverSide, open }: ScheduleListContentProps) => { export const ScheduleListContent = ({ date, setMode, popoverAlign, popoverSide, open }: ScheduleListContentProps) => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [scheduleList, setScheduleList] = useState([]); const [scheduleList, setScheduleList] = useState<Array<ScheduleListData>>([]);
const [filteredList, setFilteredList] = useState([]);
const scheduleNetwork = new ScheduleNetwork(); const scheduleNetwork = new ScheduleNetwork();
const listScheduleForm = useForm<z.infer<typeof ListScheduleSchema>>({ const listScheduleForm = useForm<z.infer<typeof ListScheduleSchema>>({
@@ -39,9 +39,10 @@ export const ScheduleListContent = ({ date, setMode, popoverAlign, popoverSide,
} = listScheduleForm.watch(); } = listScheduleForm.watch();
useEffect(() => { useEffect(() => {
if (isLoading) { if (isLoading || !open) {
return; return;
} }
reqList();
return (() => { return (() => {
setIsLoading(false); setIsLoading(false);
@@ -51,8 +52,8 @@ export const ScheduleListContent = ({ date, setMode, popoverAlign, popoverSide,
const reqList = async () => { const reqList = async () => {
const data = { const data = {
name, name,
startDate, startDate: date,
endDate, endDate: date,
status: status as ScheduleStatus | undefined, status: status as ScheduleStatus | undefined,
styleList, styleList,
typeList: typeList as ScheduleType[] | undefined typeList: typeList as ScheduleType[] | undefined
@@ -60,6 +61,9 @@ export const ScheduleListContent = ({ date, setMode, popoverAlign, popoverSide,
const result = await scheduleNetwork.getList(data); const result = await scheduleNetwork.getList(data);
if (result.data.success) {
setScheduleList(result.data.data!);
}
} }
return ( return (