Skip to content

Commit

Permalink
Merge pull request #1509 from Availity/feature/fudCloud
Browse files Browse the repository at this point in the history
feat: use cloud file upload delivery endpoint if vault cloud or endpoint override used
  • Loading branch information
christieb7007 authored Jan 21, 2025
2 parents 62088cd + 2930a27 commit 220e44b
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions packages/form-upload/src/Upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const Dropzone = React.lazy(() => import('react-dropzone'));
const dropzoneFallback = <div data-testid="dropzone-fallback">Loading...</div>;

const CLOUD_URL = '/cloud/web/appl/vault/upload/v1/resumable';
const CLOUD_URL_FUD = '/cloud/web/appl/file-upload-delivery/v1/batch/deliveries';

const Upload = ({
allowedFileNameCharacters,
Expand Down Expand Up @@ -76,13 +77,22 @@ const Upload = ({
},
],
};

uploadResults.push(
avFilesDeliveryApi.uploadFilesDelivery(data, {
clientId,
customerId,
})
);
if (isCloud) {
uploadResults.push(
avFilesDeliveryApi.uploadFilesDelivery(data, {
name: CLOUD_URL_FUD,
clientId,
customerId,
})
);
} else {
uploadResults.push(
avFilesDeliveryApi.uploadFilesDelivery(data, {
clientId,
customerId,
})
);
}
}

const responses = await Promise.all(uploadResults);
Expand All @@ -105,6 +115,7 @@ const Upload = ({
setFieldError,
onDeliverySuccess,
onDeliveryError,
isCloud
]
);

Expand Down Expand Up @@ -174,8 +185,8 @@ const Upload = ({
maxSize,
allowedFileNameCharacters,
};
if (endpoint) options.endpoint = endpoint;
if (isCloud) options.endpoint = CLOUD_URL;
if (endpoint) options.endpoint = endpoint;
const upload = new UploadCore(file, options);
upload.id = `${upload.id}-${uuid()}`;
if (file.dropRejectionMessage) {
Expand Down

0 comments on commit 220e44b

Please sign in to comment.