From 69999d8e8bdb6aa3a1014e99396cbe3f673384b3 Mon Sep 17 00:00:00 2001 From: sabhas Date: Sun, 18 Jul 2021 21:34:16 +0500 Subject: [PATCH] fix: update fileUpload method to override existing config --- src/SASjs.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/SASjs.ts b/src/SASjs.ts index d60ad27..6e7df78 100644 --- a/src/SASjs.ts +++ b/src/SASjs.ts @@ -540,11 +540,22 @@ export default class SASjs { * 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 params - request URL parameters. + * @param config - object to override existing config (optional) */ - public uploadFile(sasJob: string, files: UploadFile[], params: any) { - const fileUploader = - this.fileUploader || - new FileUploader(this.sasjsConfig, this.jobsPath, this.requestClient!) + public uploadFile( + sasJob: string, + files: UploadFile[], + 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) }