fix: popup spinner 동작 추가

This commit is contained in:
yoosangwook 2025-03-25 14:20:28 +09:00
parent 8d645d08dc
commit c7de33b8b9
2 changed files with 7 additions and 1 deletions

Binary file not shown.

View File

@ -1,5 +1,5 @@
import { useEffect, useRef, useState } from 'react'
import { useRecoilState } from 'recoil'
import { useRecoilState, useSetRecoilState } from 'recoil'
import { useSwal } from '@/hooks/useSwal'
import { useAxios } from '../useAxios'
@ -7,6 +7,7 @@ import { currentCanvasPlanState } from '@/store/canvasAtom'
import { useCanvas } from '@/hooks/useCanvas'
import { deleteBackGroundImage, setBackGroundImage } from '@/lib/imageActions'
import { settingModalFirstOptionsState } from '@/store/settingAtom'
import { popSpinnerState } from '@/store/popupAtom'
/**
* 배경 이미지 관리
@ -29,6 +30,7 @@ export function useRefFiles() {
const { handleBackImageLoadToCanvas } = useCanvas()
const { swalFire } = useSwal()
const { get, post, del } = useAxios()
const setPopSpinnerStore = useSetRecoilState(popSpinnerState)
useEffect(() => {
if (refFileMethod === '1') {
@ -84,6 +86,7 @@ export function useRefFiles() {
text: '삭제하시겠습니까?',
type: 'confirm',
confirmFn: async () => {
setPopSpinnerStore(true)
console.log('🚀 ~ handleFileDelete ~ handleFileDelete:', refImage)
console.log('🚀 ~ handleFileDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName)
await del({ url: `http://localhost:3000/api/image/upload?fileName=${currentCanvasPlan.bgImageName}` })
@ -94,6 +97,7 @@ export function useRefFiles() {
objectId: currentCanvasPlan.id,
planNo: currentCanvasPlan.planNo,
})
setPopSpinnerStore(false)
},
})
}
@ -188,6 +192,7 @@ export function useRefFiles() {
* @param {*} file
*/
const handleUploadImageRefFile = async (file) => {
setPopSpinnerStore(true)
const newOption1 = settingModalFirstOptions.option1.map((option) => ({
...option,
selected: option.column === 'imageDisplay' ? true : option.selected,
@ -222,6 +227,7 @@ export function useRefFiles() {
}
console.log('🚀 ~ handleUploadImageRefFile ~ params:', params)
await setBackGroundImage(params)
setPopSpinnerStore(false)
}
/**