mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-17 00:50:05 +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 logLink - url of the log file.
|
||||||
* @param accessToken - an access token for an authorized user.
|
* @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) => {
|
return new Promise((resolve, reject) => {
|
||||||
fetch(logLink, {
|
fetch(logLink, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers
|
||||||
'Content-Type': 'application/json',
|
|
||||||
Authorization: 'Bearer ' + accessToken
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response: any) => response.text())
|
.then((response: any) => response.text())
|
||||||
.then((response: any) => resolve(response))
|
.then((response: any) => resolve(response))
|
||||||
|
|||||||
Reference in New Issue
Block a user