1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-14 23:50:06 +00:00

fix: update fileUpload method to override existing config

This commit is contained in:
2021-07-18 21:34:16 +05:00
parent 7cb2a43f95
commit 69999d8e8b

View File

@@ -540,11 +540,22 @@ export default class SASjs {
* Process). Is prepended at runtime with the value of `appLoc`. * Process). Is prepended at runtime with the value of `appLoc`.
* @param files - array of files to be uploaded, including File object and file name. * @param files - array of files to be uploaded, including File object and file name.
* @param params - request URL parameters. * @param params - request URL parameters.
* @param config - object to override existing config (optional)
*/ */
public uploadFile(sasJob: string, files: UploadFile[], params: any) { public uploadFile(
const fileUploader = sasJob: string,
this.fileUploader || files: UploadFile[],
new FileUploader(this.sasjsConfig, this.jobsPath, this.requestClient!) params: any,
config?: any
) {
const fileUploader = config
? new FileUploader(
{ ...this.sasjsConfig, ...config },
this.jobsPath,
this.requestClient!
)
: this.fileUploader ||
new FileUploader(this.sasjsConfig, this.jobsPath, this.requestClient!)
return fileUploader.uploadFile(sasJob, files, params) return fileUploader.uploadFile(sasJob, files, params)
} }