1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-16 08:30:07 +00:00

Compare commits

..

2 Commits

Author SHA1 Message Date
Yury Shkoda
fa87111f4a Merge pull request #126 from sasjs/issue-124
fix(context): fixed 'getExecutableContexts' method
2020-10-07 17:53:31 +03:00
Yury Shkoda
94967b0f6c fix(context): fixed 'getExecutableContexts' method 2020-10-07 17:25:47 +03:00

View File

@@ -152,24 +152,25 @@ export class SASViyaApiClient {
accessToken, accessToken,
null, null,
true true
).catch(() => null) ).catch((err) => err)
}) })
const results = await Promise.all(promises) const results = await Promise.all(promises)
results.forEach((result: any, index: number) => { results.forEach((result: any, index: number) => {
if (result) { if (result && result.body && result.body.details) {
try {
const resultParsed = JSON.parse(result.body.details)
if (resultParsed && resultParsed.body) {
let sysUserId = '' let sysUserId = ''
if (result.log) { const sysUserIdLog = resultParsed.body
const sysUserIdLog = result.log
.split('\n') .split('\n')
.find((line: string) => line.startsWith('SYSUSERID=')) .find((line: string) => line.startsWith('SYSUSERID='))
if (sysUserIdLog) { if (sysUserIdLog) {
sysUserId = sysUserIdLog.replace('SYSUSERID=', '') sysUserId = sysUserIdLog.replace('SYSUSERID=', '')
}
}
executableContexts.push({ executableContexts.push({
createdBy: contextsList[index].createdBy, createdBy: contextsList[index].createdBy,
@@ -181,6 +182,11 @@ export class SASViyaApiClient {
} }
}) })
} }
}
} catch (error) {
throw error
}
}
}) })
return executableContexts return executableContexts