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:
11
src/SASjs.ts
11
src/SASjs.ts
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user