feat(expense): add persistent zero-entry receipt association
This commit is contained in:
@@ -1,21 +1,25 @@
|
||||
import { apiRequest } from './api.js'
|
||||
import { normalizeAttachmentAssociationJob } from '../utils/attachmentAssociationJobModel.js'
|
||||
|
||||
export { normalizeAttachmentAssociationJob } from '../utils/attachmentAssociationJobModel.js'
|
||||
|
||||
function normalizeJobId(jobId) {
|
||||
return String(jobId || '').trim()
|
||||
}
|
||||
|
||||
export function createAttachmentAssociationJob(payload = {}) {
|
||||
return apiRequest('/reimbursements/attachment-association-jobs', {
|
||||
export async function createAttachmentAssociationJob(payload = {}) {
|
||||
const job = await apiRequest('/reimbursements/attachment-association-jobs', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload || {})
|
||||
})
|
||||
return normalizeAttachmentAssociationJob(job)
|
||||
}
|
||||
|
||||
export function fetchAttachmentAssociationJob(jobId) {
|
||||
export async function fetchAttachmentAssociationJob(jobId) {
|
||||
const normalizedJobId = normalizeJobId(jobId)
|
||||
if (!normalizedJobId) {
|
||||
throw new Error('附件关联任务不存在或已失效。')
|
||||
}
|
||||
return apiRequest(`/reimbursements/attachment-association-jobs/${encodeURIComponent(normalizedJobId)}`)
|
||||
const job = await apiRequest(`/reimbursements/attachment-association-jobs/${encodeURIComponent(normalizedJobId)}`)
|
||||
return normalizeAttachmentAssociationJob(job)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user