1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-13 23:20:05 +00:00

chore(*): change code style to use single quote

This commit is contained in:
Yury Shkoda
2020-09-01 14:28:15 +03:00
parent 82b14fad14
commit c626c57662
28 changed files with 404 additions and 404 deletions

View File

@@ -1,5 +1,5 @@
import { Session, Context, CsrfToken } from "./types"
import { asyncForEach, makeRequest } from "./utils"
import { Session, Context, CsrfToken } from './types'
import { asyncForEach, makeRequest } from './utils'
const MAX_SESSION_COUNT = 1
@@ -32,7 +32,7 @@ export class SessionManager {
async clearSession(id: string, accessToken?: string) {
const deleteSessionRequest = {
method: "DELETE",
method: 'DELETE',
headers: this.getHeaders(accessToken)
}
return await this.request<Session>(
@@ -57,7 +57,7 @@ export class SessionManager {
private async createAndWaitForSession(accessToken?: string) {
const createSessionRequest = {
method: "POST",
method: 'POST',
headers: this.getHeaders(accessToken)
}
const { result: createdSession, etag } = await this.request<Session>(
@@ -99,7 +99,7 @@ export class SessionManager {
private getHeaders(accessToken?: string) {
const headers: any = {
"Content-Type": "application/json"
'Content-Type': 'application/json'
}
if (accessToken) {
headers.Authorization = `Bearer ${accessToken}`
@@ -117,21 +117,21 @@ export class SessionManager {
let sessionState = session.state
const headers: any = {
...this.getHeaders(accessToken),
"If-None-Match": etag
'If-None-Match': etag
}
const stateLink = session.links.find((l: any) => l.rel === "state")
const stateLink = session.links.find((l: any) => l.rel === 'state')
return new Promise(async (resolve, _) => {
if (sessionState === "pending") {
if (sessionState === 'pending') {
if (stateLink) {
if (!silent) {
console.log("Polling session status... \n")
console.log('Polling session status... \n')
}
const { result: state } = await this.request<string>(
`${this.serverUrl}${stateLink.href}?wait=30`,
{
headers
},
"text"
'text'
)
sessionState = state.trim()
@@ -149,7 +149,7 @@ export class SessionManager {
private async request<T>(
url: string,
options: RequestInit,
contentType: "text" | "json" = "json"
contentType: 'text' | 'json' = 'json'
) {
if (this.csrfToken) {
options.headers = {