Skip to content

Commit

Permalink
Merge pull request #37 from BIDMCDigitalPsychiatry/jwt-updates
Browse files Browse the repository at this point in the history
Fixing issues with token
  • Loading branch information
sarithapillai8 authored Nov 18, 2024
2 parents ef795df + c513388 commit a62cfad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/service/Credential.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,12 @@ export class CredentialService {

return await Fetch.post("/login", { accessKey, secretKey }, this.configuration)
}

public async renewToken(refreshToken: string): Promise<any> {
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)
}
}
}
1 change: 1 addition & 0 deletions src/service/Fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ async function _fetch<ResultType>(
}

if (authorization) {
console.log(`####configuration.base`, configuration.base)
try {
var result = await (
await fetch(`${configuration.base}${route}`, {
Expand Down

0 comments on commit a62cfad

Please sign in to comment.