useEffect내부 async 제거
This commit is contained in:
parent
d06733ed4c
commit
001c1cfd95
@ -36,28 +36,31 @@ import { useMasterController } from '@/hooks/common/useMasterController'
|
|||||||
export default function CanvasFrame() {
|
export default function CanvasFrame() {
|
||||||
const [roofMaterials, setRoofMaterials] = useRecoilState(roofMaterialsAtom)
|
const [roofMaterials, setRoofMaterials] = useRecoilState(roofMaterialsAtom)
|
||||||
const { getRoofMaterialList } = useMasterController()
|
const { getRoofMaterialList } = useMasterController()
|
||||||
useEffect(async () => {
|
useEffect(() => {
|
||||||
if (roofMaterials.length !== 0) {
|
async function initRoofMaterial() {
|
||||||
return
|
if (roofMaterials.length !== 0) {
|
||||||
}
|
return
|
||||||
const { data } = await getRoofMaterialList()
|
}
|
||||||
|
const { data } = await getRoofMaterialList()
|
||||||
|
|
||||||
const roofLists = data.map((item, idx) => ({
|
const roofLists = data.map((item, idx) => ({
|
||||||
...item,
|
...item,
|
||||||
id: item.roofMatlCd,
|
id: item.roofMatlCd,
|
||||||
name: item.roofMatlNm,
|
name: item.roofMatlNm,
|
||||||
selected: idx === 0,
|
selected: idx === 0,
|
||||||
index: idx,
|
index: idx,
|
||||||
nameJp: item.roofMatlNmJp,
|
nameJp: item.roofMatlNmJp,
|
||||||
length: item.lenBase && parseInt(item.lenBase),
|
length: item.lenBase && parseInt(item.lenBase),
|
||||||
width: item.widBase && parseInt(item.widBase),
|
width: item.widBase && parseInt(item.widBase),
|
||||||
raft: item.raftBase && parseInt(item.raftBase),
|
raft: item.raftBase && parseInt(item.raftBase),
|
||||||
layout: ['ROOF_ID_SLATE', 'ROOF_ID_SINGLE'].includes(item.roofMatlCd) ? ROOF_MATERIAL_LAYOUT.STAIRS : ROOF_MATERIAL_LAYOUT.PARALLEL,
|
layout: ['ROOF_ID_SLATE', 'ROOF_ID_SINGLE'].includes(item.roofMatlCd) ? ROOF_MATERIAL_LAYOUT.STAIRS : ROOF_MATERIAL_LAYOUT.PARALLEL,
|
||||||
hajebichi: item.roofPchBase && parseInt(item.roofPchBase),
|
hajebichi: item.roofPchBase && parseInt(item.roofPchBase),
|
||||||
pitch: item.pitch ? parseInt(item.pitch) : 4,
|
pitch: item.pitch ? parseInt(item.pitch) : 4,
|
||||||
angle: item.angle ? parseInt(item.angle) : 21.8,
|
angle: item.angle ? parseInt(item.angle) : 21.8,
|
||||||
}))
|
}))
|
||||||
setRoofMaterials(roofLists)
|
setRoofMaterials(roofLists)
|
||||||
|
}
|
||||||
|
initRoofMaterial()
|
||||||
}, [])
|
}, [])
|
||||||
const canvasRef = useRef(null)
|
const canvasRef = useRef(null)
|
||||||
const { canvas } = useCanvas('canvas')
|
const { canvas } = useCanvas('canvas')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user