1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 09:24:35 +00:00

chore(fetchLogFileContent): made accessToken optional

This commit is contained in:
Yury Shkoda
2020-10-30 11:26:43 +03:00
parent 64a976e888
commit 35cc1e4f62

View File

@@ -1269,14 +1269,15 @@ export default class SASjs {
* @param logLink - url of the log file.
* @param accessToken - an access token for an authorized user.
*/
public fetchLogFileContent(logLink: string, accessToken: string) {
public fetchLogFileContent(logLink: string, accessToken?: string) {
const headers: any = { 'Content-Type': 'application/json' }
if (accessToken) headers.Authorization = 'Bearer ' + accessToken
return new Promise((resolve, reject) => {
fetch(logLink, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + accessToken
}
headers
})
.then((response: any) => response.text())
.then((response: any) => resolve(response))