From 9da2a29a7218295fb4916eeedb3212ca26702cc0 Mon Sep 17 00:00:00 2001 From: Mihajlo Date: Sun, 28 Mar 2021 21:55:47 +0200 Subject: [PATCH] chore: for VIYA calling API endpoint --- src/auth/AuthManager.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/auth/AuthManager.ts b/src/auth/AuthManager.ts index a11573d..d917b76 100644 --- a/src/auth/AuthManager.ts +++ b/src/auth/AuthManager.ts @@ -82,14 +82,15 @@ export class AuthManager { * @returns - a promise which resolves with an object containing two values - a boolean `isLoggedIn`, and a string `userName`. */ public async checkSession() { + //For VIYA we will send request on API endpoint. Which is faster then pinging SASJobExecution. + //For SAS9 we will send request on SASStoredProcess + const url = + this.serverType === 'SASVIYA' + ? `${this.serverUrl}/identities` + : `${this.serverUrl}/SASStoredProcess` + const { result: loginResponse } = await this.requestClient - .get( - `${this.serverUrl}/${ - this.serverType === 'SASVIYA' ? 'SASJobExecution' : 'SASStoredProcess' - }`, - undefined, - 'text/plain' - ) + .get(url, undefined, 'text/plain') .catch((err: any) => { return { result: 'authErr' } })