mirror of
https://git.hmsn.ink/kospo/svcm/oa.git
synced 2026-03-20 19:03:49 +09:00
Merge branch 'refs/heads/main' into featrue/0526-update
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import axios from 'axios'
|
||||
|
||||
/**
|
||||
* 계약관리 조회(페이징)
|
||||
* @property {string} params.page - 페이지
|
||||
* @property {string} params.row - 아이템갯수
|
||||
*
|
||||
*/``
|
||||
export async function getContractList(params = {}) {
|
||||
try {
|
||||
const result = await axios.get(`/api/cont/page`,params)
|
||||
return result.data
|
||||
} catch (e) {
|
||||
if (e.response) {
|
||||
if (e.response.status >= 500) {
|
||||
throw new Error('서버 오류가 발생했습니다.')
|
||||
} else if (e.response.status >= 400) {
|
||||
throw new Error('잘못된 요청입니다.')
|
||||
} else if (e.response._data && e.response._data.message) {
|
||||
throw new Error(e.response._data.message)
|
||||
}
|
||||
}
|
||||
throw new Error(e.message || '알 수 없는 오류')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 계약관리 저장
|
||||
* @param {object} params
|
||||
* @property {string} params.cateNm - 분야
|
||||
* @property {string} params.cateNm - 결제상태
|
||||
* @property {string} params.regNm - 담당자
|
||||
* @property {string} params.regSdat - 등록기간
|
||||
* @returns
|
||||
*/
|
||||
export async function saveContract(params = {}) {
|
||||
try {
|
||||
const result = await axios.post(`/api/cont`,params)
|
||||
return result
|
||||
} catch (e) {
|
||||
const serverError = e.response?.data;
|
||||
|
||||
const message = typeof serverError?.body === 'string'
|
||||
? serverError.body
|
||||
: 'Unknown error occurred';
|
||||
|
||||
const error = new Error(message); // ✅ 반드시 string만 넣기! 아니면 객체가 문자열로 나옴
|
||||
error.code = serverError?.code;
|
||||
error.errTime = serverError?.errTime;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -17,12 +17,6 @@ export async function getIntegratedApproval(params = {}) {
|
||||
console.log(result)
|
||||
if (result.status === 200) {
|
||||
return result.data
|
||||
} else if (result.status >= 500) {
|
||||
throw new Error('서버 오류가 발생했습니다.')
|
||||
} else if (result.status >= 400) {
|
||||
throw new Error('잘못된 요청입니다.')
|
||||
} else {
|
||||
throw new Error(`예상치 못한 상태코드: ${result.status}`)
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.response) {
|
||||
@@ -55,10 +49,6 @@ export async function updateIntegratedApproval(params = {}) {
|
||||
})
|
||||
if (result.status === 200) {
|
||||
return result.data
|
||||
} else if (result.status >= 500) {
|
||||
throw new Error('서버 오류가 발생했습니다.')
|
||||
} else {
|
||||
throw new Error(`예상치 못한 상태코드: ${result.status}`)
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user