api error 처리 추가
This commit is contained in:
parent
9754fb6049
commit
bd31ce0791
@ -6,6 +6,7 @@ import { getDegreeByChon } from '@/util/canvas-util'
|
|||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { useMasterController } from '@/hooks/common/useMasterController'
|
import { useMasterController } from '@/hooks/common/useMasterController'
|
||||||
import { basicSettingState } from '@/store/settingAtom'
|
import { basicSettingState } from '@/store/settingAtom'
|
||||||
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
|
|
||||||
// 회로 및 가대설정
|
// 회로 및 가대설정
|
||||||
export const useTrestle = () => {
|
export const useTrestle = () => {
|
||||||
@ -14,7 +15,7 @@ export const useTrestle = () => {
|
|||||||
const { getQuotationItem } = useMasterController()
|
const { getQuotationItem } = useMasterController()
|
||||||
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
|
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
|
||||||
const roofSizeSet = useRecoilValue(basicSettingState).roofSizeSet
|
const roofSizeSet = useRecoilValue(basicSettingState).roofSizeSet
|
||||||
|
const { swalFire } = useSwal()
|
||||||
const apply = () => {
|
const apply = () => {
|
||||||
try {
|
try {
|
||||||
//처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함.
|
//처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함.
|
||||||
@ -616,11 +617,13 @@ export const useTrestle = () => {
|
|||||||
})
|
})
|
||||||
const params = { trestles: surfaces.map((surface) => surface.quotationParam), pcses }
|
const params = { trestles: surfaces.map((surface) => surface.quotationParam), pcses }
|
||||||
//견적서 itemList 조회
|
//견적서 itemList 조회
|
||||||
const res = await getQuotationItem(params)
|
const { data: itemList, data2, result } = await getQuotationItem(params)
|
||||||
if (!res.data) {
|
|
||||||
|
if (result.resultCode === 'E') {
|
||||||
|
swalFire({ text: result.resultMsg, icon: 'error' })
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const itemList = res.data
|
|
||||||
//northArrangement 북면 설치 여부
|
//northArrangement 북면 설치 여부
|
||||||
const northArrangement = getNorthArrangement()
|
const northArrangement = getNorthArrangement()
|
||||||
// circuitItemList의 경우는 moduleList에서 circuitId만 groupBy한다.
|
// circuitItemList의 경우는 moduleList에서 circuitId만 groupBy한다.
|
||||||
@ -678,10 +681,7 @@ export const useTrestle = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const estimateParam = { itemList, northArrangement, roofSurfaceList, circuitItemList }
|
return { itemList, northArrangement, roofSurfaceList, circuitItemList }
|
||||||
|
|
||||||
// 정상적으로 완료 되면 true 반환
|
|
||||||
return estimateParam
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getNorthArrangement = () => {
|
const getNorthArrangement = () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user