feat(expenses): add authoritative pre-review workflow
This commit is contained in:
@@ -224,10 +224,26 @@ export function updateExpenseClaimItem(claimId, itemId, payload) {
|
||||
})
|
||||
}
|
||||
|
||||
export function submitExpenseClaim(claimId) {
|
||||
function createPreReviewRequestId() {
|
||||
if (typeof globalThis.crypto?.randomUUID === 'function') {
|
||||
return `pre-review:${globalThis.crypto.randomUUID()}`
|
||||
}
|
||||
return `pre-review:${Date.now()}:${Math.random().toString(16).slice(2)}`
|
||||
}
|
||||
|
||||
export function preReviewExpenseClaim(claimId, requestId = '') {
|
||||
const normalizedRequestId = String(requestId || '').trim() || createPreReviewRequestId()
|
||||
return apiRequest(`/reimbursements/claims/${encodeURIComponent(String(claimId || '').trim())}/pre-review`, {
|
||||
method: 'POST',
|
||||
headers: { 'X-Request-ID': normalizedRequestId },
|
||||
body: JSON.stringify({})
|
||||
})
|
||||
}
|
||||
|
||||
export function submitExpenseClaim(claimId, payload = {}) {
|
||||
return apiRequest(`/reimbursements/claims/${encodeURIComponent(String(claimId || '').trim())}/submit`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({})
|
||||
body: JSON.stringify(payload || {})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user