mirror of
https://git.hmsn.ink/kospo/svcm/oa.git
synced 2026-03-20 03:12:27 +09:00
func : 전표 임시 api 생성 추가
This commit is contained in:
72
src/service/slipApi.ts
Normal file
72
src/service/slipApi.ts
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user