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

fix(fileUploader): added loginCallback

This commit is contained in:
Saad Jutt
2021-09-14 05:58:40 +05:00
parent 10cf4998f5
commit 15ff90025a
2 changed files with 20 additions and 7 deletions

View File

@@ -571,19 +571,32 @@ 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 overrideSasjsConfig - object to override existing config (optional) * @param config - provide any changes to the config here, for instance to
* enable/disable `debug`. Any change provided will override the global config,
* for that particular function call.
* @param loginRequiredCallback - a function that is called if the
* user is not logged in (eg to display a login form). The request will be
* resubmitted after successful login.
*/ */
public async uploadFile( public async uploadFile(
sasJob: string, sasJob: string,
files: UploadFile[], files: UploadFile[],
params: any, params: { [key: string]: any } | null,
overrideSasjsConfig?: any config: { [key: string]: any } = {},
loginRequiredCallback?: () => any
) { ) {
const config = { config = {
...this.sasjsConfig, ...this.sasjsConfig,
...overrideSasjsConfig ...config
} }
return await this.fileUploader!.execute(sasJob, files, params, config) const data = { files, params }
return await this.fileUploader!.execute(
sasJob,
data,
config,
loginRequiredCallback
)
} }
/** /**

View File

@@ -15,7 +15,7 @@ import { BaseJobExecutor } from './JobExecutor'
interface dataFileUpload { interface dataFileUpload {
files: UploadFile[] files: UploadFile[]
params: any params: { [key: string]: any } | null
} }
export class FileUploader extends BaseJobExecutor { export class FileUploader extends BaseJobExecutor {