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

chore: fixing useComputeApi defaults

This commit is contained in:
2021-06-22 16:51:14 +02:00
parent abc15fb3ab
commit 5d7cfe1e6c
3 changed files with 13 additions and 17 deletions

View File

@@ -38,12 +38,7 @@ export class FileUploader {
: sasJob
const uploadUrl = `${this.jobsPath}/?${
'_program=' + program
}${paramsString}${
this.sasjsConfig.serverType === ServerType.SasViya &&
this.sasjsConfig.contextName
? '&_contextname=' + this.sasjsConfig.contextName
: ''
}`
}${paramsString}`
const formData = new FormData()
@@ -54,6 +49,7 @@ export class FileUploader {
const csrfToken = this.requestClient.getCsrfToken('file')
if (csrfToken) formData.append('_csrf', csrfToken.value)
if (this.sasjsConfig.debug) formData.append('_debug', '131')
if (this.sasjsConfig.serverType === ServerType.SasViya && this.sasjsConfig.contextName) formData.append('_contextname', this.sasjsConfig.contextName)
const headers = {
'cache-control': 'no-cache',
@@ -63,8 +59,12 @@ export class FileUploader {
return this.requestClient
.post(uploadUrl, formData, undefined, 'application/json', headers)
.then((res) =>
typeof res.result === 'string' ? JSON.parse(res.result) : res.result
.then((res) => {
let result
result = typeof res.result === 'string' ? JSON.parse(res.result) : res.result
//TODO: append to SASjs requests
}
)
.catch((err: Error) => {
if (err instanceof LoginRequiredError) {