diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 412571587..d2a380107 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -689,7 +689,7 @@ const drainageEquipmentList : DrainageEquipmentListProps[] = [ * Store - api (데이터 호출) ====================================*/ /* 시설정보 및 운영현황 - 계획 */ -const fetchFacilityPlan = async (targetYear : string | undefined, fcltyCd : string | undefined) => { +const fetchFacilityPlan = async (targetYear : string | undefined, fcltyCd : string | undefined, set : (fn: (state: DashBoardType) => DashBoardType) => void) => { try { targetYear = targetYear ? targetYear : "2024"; const baseUrl = 'https://apigateway.rsonesoft.com/dc-service/api/v1/nowDmgMtncGnsvy'; @@ -703,6 +703,14 @@ const fetchFacilityPlan = async (targetYear : string | undefined, fcltyCd : stri return res } catch (error) { console.error('시설계획정보를 가져오는데 실패했습니다:', error); + set((state) => ({ + ...state, + PlanFclty : { + ...state.PlanFclty, + isLoadingPlanFclty : false, + isLoadingOperationStatus : false + } + })); return {data: [], count: 0}; } }; @@ -1069,7 +1077,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) isLoadingPlanFclty: true, }, })); - const res = await fetchFacilityPlan(targetYear, fcltyCd); + const res = await fetchFacilityPlan(targetYear, fcltyCd, set); let waterUsage = [0, 0, 0]; let minDiff=9999999; let minIndex; diff --git a/apps/fo/app/store/processArea/index.tsx b/apps/fo/app/store/processArea/index.tsx index a737d153c..67fe2fa29 100644 --- a/apps/fo/app/store/processArea/index.tsx +++ b/apps/fo/app/store/processArea/index.tsx @@ -227,7 +227,7 @@ const fetchFacilityDetailInfo = async (swtrmtFcltCd: string) => { }; // 시설정보 리스트 데이터 호출(구분 선택 후 시설명 있을 경우) -const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm : string | undefined, sggNm : string | undefined, targetYear : string | undefined ): Promise<{data:ProcessAreaProps[], count:number}> => { +const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm : string | undefined, sggNm : string | undefined, targetYear : string | undefined, set : (fn: (state: ProcessAreaType) => ProcessAreaType) => void): Promise<{data:ProcessAreaProps[], count:number}> => { try { targetYear = targetYear ? targetYear : "2023"; console.log('targetYear', targetYear); @@ -294,6 +294,13 @@ const fetchProcessAreaList = async (pageNo : number, pageSize : number, ctpvNm : } } catch (error) { console.error('시설계획정보를 가져오는데 실패했습니다:', error); + set((state) => ({ + ...state, + ProcessArea : { + ...state.ProcessArea, + isLoading : false + } + })); return {data: [], count: 0}; } }; @@ -378,7 +385,7 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set: isLoading: true, }, })); - const res = await fetchProcessAreaList(pageNo, pageSize, ctpvNm, sggNm, targetYear); + const res = await fetchProcessAreaList(pageNo, pageSize, ctpvNm, sggNm, targetYear, set); res.data.forEach((item:ProcessAreaProps) => { DataForm({ type: 'float1', column: 'fctCpc', item:item as unknown as Record}); })