물건 상세 api 에러 메세지 띄우도록

This commit is contained in:
basssy 2024-12-06 14:10:33 +09:00
parent 96b163f1ac
commit 9042731ff8

View File

@ -917,7 +917,11 @@ export default function StuffDetail() {
}) })
// WL_ // WL_
form.setValue('standardWindSpeedId', `WL_${info.windSpeed}`) if (info.windSpeed !== '') {
form.setValue('standardWindSpeedId', `WL_${info.windSpeed}`)
} else {
form.setValue('standardWindSpeedId', `WL_${info.windSpeed}`)
}
form.setValue('verticalSnowCover', info.verticalSnowCover) form.setValue('verticalSnowCover', info.verticalSnowCover)
form.setValue('surfaceType', info.surfaceType) form.setValue('surfaceType', info.surfaceType)
@ -1046,7 +1050,7 @@ export default function StuffDetail() {
errors.prefId = true errors.prefId = true
} }
if (!formData.areaId) { if (!formData.areaId || formData.areaId === '0') {
errors.areaId = true errors.areaId = true
} }
@ -1290,23 +1294,34 @@ export default function StuffDetail() {
} }
if (editMode === 'NEW') { if (editMode === 'NEW') {
await promisePost({ url: apiUrl, data: params }).then((res) => { await promisePost({ url: apiUrl, data: params })
// .then((res) => {
if (res.status === 201) { //
alert(getMessage('stuff.detail.save')) if (res.status === 201) {
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo }) alert(getMessage('stuff.detail.save'))
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false }) setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
} router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
}) }
})
.catch((error) => {
console.log('error::::::', error)
alert(error?.response.data.message)
})
} else { } else {
// PUT // PUT
await promisePut({ url: apiUrl, data: params }).then((res) => { // await promisePut({ url: apiUrl, data: params }).then((res) => {
if (res.status === 201) { await promisePut({ url: apiUrl, data: params })
setFloorPlanObjectNo({ floorPlanObjectNo: res.data.objectNo }) .then((res) => {
alert(getMessage('stuff.detail.save')) if (res.status === 201) {
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false }) setFloorPlanObjectNo({ floorPlanObjectNo: res.data.objectNo })
} alert(getMessage('stuff.detail.save'))
}) router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
}
})
.catch((error) => {
console.log('error::::::', error)
alert(error?.response.data.message)
})
} }
} }
@ -1351,19 +1366,29 @@ export default function StuffDetail() {
const apiUrl = '/api/object/save-object' const apiUrl = '/api/object/save-object'
if (objectNo) { if (objectNo) {
await promisePut({ url: apiUrl, data: params }).then((res) => { await promisePut({ url: apiUrl, data: params })
if (res.status === 201) { .then((res) => {
alert(getMessage('stuff.detail.tempSave.message1')) if (res.status === 201) {
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false }) alert(getMessage('stuff.detail.tempSave.message1'))
} router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
}) }
})
.catch((error) => {
console.log('error::::::', error)
alert(error?.response.data.message)
})
} else { } else {
await promisePost({ url: apiUrl, data: params }).then((res) => { await promisePost({ url: apiUrl, data: params })
if (res.status === 201) { .then((res) => {
alert(getMessage('stuff.detail.tempSave.message1')) if (res.status === 201) {
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false }) alert(getMessage('stuff.detail.tempSave.message1'))
} router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
}) }
})
.catch((error) => {
console.log('error::::::', error)
alert(error?.response.data.message)
})
} }
} }