From c513388750e5e6fc31b90b2f21ab82aa8118b1af Mon Sep 17 00:00:00 2001 From: "ITHQ1947\\saritha.pillai" Date: Wed, 16 Oct 2024 12:49:03 +0530 Subject: [PATCH] Fixing issues with token --- src/service/Credential.service.ts | 9 ++++++--- src/service/Fetch.ts | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/service/Credential.service.ts b/src/service/Credential.service.ts index 3d8e1dc..da5de98 100644 --- a/src/service/Credential.service.ts +++ b/src/service/Credential.service.ts @@ -257,9 +257,12 @@ export class CredentialService { return await Fetch.post("/login", { accessKey, secretKey }, this.configuration) } - public async renewToken(refreshToken: string): Promise { - const configuration: Configuration = { accesToken: refreshToken, base: null } - return await Fetch.post("/renewToken", { refreshToken }, configuration) + const AUTH_SESSION = JSON.parse(sessionStorage?.getItem("LAMP._auth") ?? "null") + const baseAPIPath = AUTH_SESSION?.serverAddress + if(baseAPIPath){ + const configuration: Configuration = { accesToken: refreshToken, base: `https://${baseAPIPath}` } + return await Fetch.post("/renewToken", { refreshToken }, configuration) + } } } diff --git a/src/service/Fetch.ts b/src/service/Fetch.ts index 7272ea5..1037d89 100644 --- a/src/service/Fetch.ts +++ b/src/service/Fetch.ts @@ -73,6 +73,7 @@ async function _fetch( } if (authorization) { + console.log(`####configuration.base`, configuration.base) try { var result = await ( await fetch(`${configuration.base}${route}`, {