mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-21 13:55:45 +00:00
feat(FE): Add travel document upload to purchase form
This commit is contained in:
@@ -72,11 +72,29 @@ export const PurchaseApi = {
|
||||
purchaseRequestId: number,
|
||||
payload: CreateAcceptApprovalRequestPayload
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> => {
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append('action', payload.action);
|
||||
|
||||
if (payload.notes) {
|
||||
formData.append('notes', payload.notes);
|
||||
}
|
||||
|
||||
if (payload.items) {
|
||||
formData.append('items', JSON.stringify(payload.items));
|
||||
}
|
||||
|
||||
if (payload.travel_documents) {
|
||||
payload.travel_documents.forEach((file) => {
|
||||
formData.append('travel_documents', file);
|
||||
});
|
||||
}
|
||||
|
||||
return await basePurchaseApi.customRequest<
|
||||
BaseApiResponse<{ message: string }>
|
||||
>(`${purchaseRequestId}/receipts`, {
|
||||
method: 'POST',
|
||||
payload,
|
||||
payload: formData as unknown as Record<string, unknown>,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user