Merge branch 'dev-ds' into dev
This commit is contained in:
commit
b5dcdfc7c8
@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useRecoilState } from 'recoil'
|
||||
import { v4 as uuidv4, validate as isValidUUID } from 'uuid'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { canvasState, currentCanvasPlanState, plansState, modifiedPlansState, modifiedPlanFlagState } from '@/store/canvasAtom'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
@ -177,7 +177,7 @@ export function usePlan() {
|
||||
* objectNo에 해당하는 canvas 목록을 조회
|
||||
*/
|
||||
const getCanvasByObjectNo = async (userId, objectNo) => {
|
||||
return get({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}/${userId}` }).then((res) =>
|
||||
return await get({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}/${userId}` }).then((res) =>
|
||||
res.map((item, index) => ({
|
||||
id: item.id,
|
||||
userId: item.userId,
|
||||
@ -234,15 +234,15 @@ export function usePlan() {
|
||||
/**
|
||||
* id에 해당하는 canvas 데이터를 삭제
|
||||
*/
|
||||
const delCanvasById = (id) => {
|
||||
return promiseDel({ url: `/api/canvas-management/canvas-statuses/by-id/${id}` })
|
||||
const delCanvasById = async (id) => {
|
||||
return await promiseDel({ url: `/api/canvas-management/canvas-statuses/by-id/${id}` })
|
||||
}
|
||||
|
||||
/**
|
||||
* objectNo에 해당하는 canvas 데이터들을 삭제
|
||||
*/
|
||||
const delCanvasByObjectNo = (objectNo) => {
|
||||
return promiseDel({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}` })
|
||||
const delCanvasByObjectNo = async (objectNo) => {
|
||||
return await promiseDel({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}` })
|
||||
}
|
||||
|
||||
/**
|
||||
@ -279,19 +279,19 @@ export function usePlan() {
|
||||
* 새로운 plan 생성
|
||||
* 현재 plan의 데이터가 있을 경우 복제 여부를 확인
|
||||
*/
|
||||
const handleAddPlan = (userId, objectNo) => {
|
||||
const handleAddPlan = async (userId, objectNo) => {
|
||||
JSON.parse(currentCanvasData()).objects.length > 0
|
||||
? swalFire({
|
||||
text: `Plan ${currentCanvasPlan.ordering} ` + getMessage('plan.message.confirm.copy'),
|
||||
type: 'confirm',
|
||||
confirmFn: () => {
|
||||
postCanvasStatus(userId, objectNo, currentCanvasData())
|
||||
confirmFn: async () => {
|
||||
await postCanvasStatus(userId, objectNo, currentCanvasData())
|
||||
},
|
||||
denyFn: () => {
|
||||
postCanvasStatus(userId, objectNo, '')
|
||||
denyFn: async () => {
|
||||
await postCanvasStatus(userId, objectNo, '')
|
||||
},
|
||||
})
|
||||
: postCanvasStatus(userId, objectNo, '')
|
||||
: await postCanvasStatus(userId, objectNo, '')
|
||||
}
|
||||
|
||||
/**
|
||||
@ -314,10 +314,10 @@ export function usePlan() {
|
||||
/**
|
||||
* plan 삭제
|
||||
*/
|
||||
const handleDeletePlan = (e, id) => {
|
||||
const handleDeletePlan = async (e, id) => {
|
||||
e.stopPropagation() // 이벤트 버블링 방지
|
||||
|
||||
delCanvasById(id)
|
||||
await delCanvasById(id)
|
||||
.then((res) => {
|
||||
setPlans((plans) => plans.filter((plan) => plan.id !== id))
|
||||
setModifiedPlans((modifiedPlans) => modifiedPlans.filter((planId) => planId !== currentCanvasPlan.id))
|
||||
@ -340,8 +340,8 @@ export function usePlan() {
|
||||
/**
|
||||
* plan 조회
|
||||
*/
|
||||
const loadCanvasPlanData = (userId, objectNo, pid) => {
|
||||
getCanvasByObjectNo(userId, objectNo).then((res) => {
|
||||
const loadCanvasPlanData = async (userId, objectNo, pid) => {
|
||||
await getCanvasByObjectNo(userId, objectNo).then((res) => {
|
||||
// console.log('canvas 목록 ', res)
|
||||
if (res.length > 0) {
|
||||
setPlans(res)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user