From bd31ce079135ca09b7d68df4084fac4af671fff9 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Wed, 5 Feb 2025 16:00:23 +0900 Subject: [PATCH] =?UTF-8?q?api=20error=20=EC=B2=98=EB=A6=AC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useTrestle.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hooks/module/useTrestle.js b/src/hooks/module/useTrestle.js index c9a0184b..c04bb3ce 100644 --- a/src/hooks/module/useTrestle.js +++ b/src/hooks/module/useTrestle.js @@ -6,6 +6,7 @@ import { getDegreeByChon } from '@/util/canvas-util' import { v4 as uuidv4 } from 'uuid' import { useMasterController } from '@/hooks/common/useMasterController' import { basicSettingState } from '@/store/settingAtom' +import { useSwal } from '@/hooks/useSwal' // 회로 및 가대설정 export const useTrestle = () => { @@ -14,7 +15,7 @@ export const useTrestle = () => { const { getQuotationItem } = useMasterController() const currentAngleType = useRecoilValue(currentAngleTypeSelector) const roofSizeSet = useRecoilValue(basicSettingState).roofSizeSet - + const { swalFire } = useSwal() const apply = () => { try { //처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함. @@ -616,11 +617,13 @@ export const useTrestle = () => { }) const params = { trestles: surfaces.map((surface) => surface.quotationParam), pcses } //견적서 itemList 조회 - const res = await getQuotationItem(params) - if (!res.data) { + const { data: itemList, data2, result } = await getQuotationItem(params) + + if (result.resultCode === 'E') { + swalFire({ text: result.resultMsg, icon: 'error' }) return null } - const itemList = res.data + //northArrangement 북면 설치 여부 const northArrangement = getNorthArrangement() // circuitItemList의 경우는 moduleList에서 circuitId만 groupBy한다. @@ -678,10 +681,7 @@ export const useTrestle = () => { } }) - const estimateParam = { itemList, northArrangement, roofSurfaceList, circuitItemList } - - // 정상적으로 완료 되면 true 반환 - return estimateParam + return { itemList, northArrangement, roofSurfaceList, circuitItemList } } const getNorthArrangement = () => {