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:
19
src/SASjs.ts
19
src/SASjs.ts
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user