1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 01:14:36 +00:00

Compare commits

...

1 Commits

Author SHA1 Message Date
sabir_hassan
591e1ebc09 fix: callback type checking fixes #304 2021-05-27 21:59:40 +05:00

View File

@@ -550,31 +550,41 @@ export default class SASjs {
...this.sasjsConfig, ...this.sasjsConfig,
...config ...config
} }
if (
if (config.serverType === ServerType.SasViya && config.contextName) { typeof loginRequiredCallback === 'function' ||
if (config.useComputeApi) { typeof loginRequiredCallback === 'undefined'
return await this.computeJobExecutor!.execute( ) {
sasJob, if (config.serverType === ServerType.SasViya && config.contextName) {
data, if (config.useComputeApi) {
config, return await this.computeJobExecutor!.execute(
loginRequiredCallback, sasJob,
accessToken data,
) config,
loginRequiredCallback,
accessToken
)
} else {
return await this.jesJobExecutor!.execute(
sasJob,
data,
config,
loginRequiredCallback,
accessToken
)
}
} else { } else {
return await this.jesJobExecutor!.execute( return await this.webJobExecutor!.execute(
sasJob, sasJob,
data, data,
config, config,
loginRequiredCallback, loginRequiredCallback
accessToken
) )
} }
} else { } else {
return await this.webJobExecutor!.execute( return Promise.reject(
sasJob, new ErrorResponse(
data, `Invalid loginRequiredCallback parameter was provided. Expected Callback function but found ${typeof loginRequiredCallback}`
config, )
loginRequiredCallback
) )
} }
} }