mirror of
https://git.hmsn.ink/kospo/svcm/oa.git
synced 2026-03-20 03:02:31 +09:00
72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
import axios from 'axios'
|
|
/**
|
|
* 임시전표 저장
|
|
* @param {object} params
|
|
* @property {string} params.contNo -계약번호
|
|
* @returns
|
|
*/
|
|
export async function saveTempSlip(params = {}) {
|
|
try {
|
|
const result = await axios.post(`/api/slip`, params)
|
|
return result.data
|
|
} 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 임시전표 삭제
|
|
* @property {string} params.contNo -계약번호
|
|
* @returns
|
|
* @param contNo
|
|
*/
|
|
export async function deleteSlipDetail(contNo: string) {
|
|
try {
|
|
const result = await axios.delete(`/api/slip/${contNo}`)
|
|
return result.data
|
|
} 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 전표 상세 조회
|
|
* * @property {string} params.contNo -계약번호
|
|
* * @returns
|
|
* * @param contNo
|
|
* */
|
|
export async function getSlipDetail(contNo: string) {
|
|
try {
|
|
const result = await axios.get(`/api/slip/page/${contNo}`)
|
|
return result.data
|
|
} 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;
|
|
}
|
|
} |