From 2fb2353c57f06710e83a9ddf73f5db89e1bfd488 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Wed, 15 May 2024 12:25:42 +0530 Subject: [PATCH] formData refactor --- lib/resources/accounts.js | 5 ++++- lib/resources/stakeholders.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/resources/accounts.js b/lib/resources/accounts.js index e682bf4..23266cb 100644 --- a/lib/resources/accounts.js +++ b/lib/resources/accounts.js @@ -36,10 +36,13 @@ module.exports = function (api) { }, uploadAccountDoc(accountId, params, callback) { + let {file, ...rest} = params return api.postFormData({ version: 'v2', url: `${BASE_URL}/${accountId}/documents`, - formData: params + formData: { + file: file.value, ...rest + } }, callback); }, diff --git a/lib/resources/stakeholders.js b/lib/resources/stakeholders.js index 6b7ed5c..bae05c3 100644 --- a/lib/resources/stakeholders.js +++ b/lib/resources/stakeholders.js @@ -36,10 +36,13 @@ module.exports = function (api) { }, uploadStakeholderDoc(accountId, stakeholderId, params, callback) { + let {file, ...rest} = params return api.postFormData({ version: 'v2', url: `${BASE_URL}/${accountId}/stakeholders/${stakeholderId}/documents`, - formData: params + formData: { + file: file.value, ...rest + } }, callback); },