fix(api-frontend): resolved failure in inviting existing infisical users to organization

This commit is contained in:
akhilmhdh
2022-12-27 23:22:47 +05:30
parent c28d857086
commit c653f807f4
5 changed files with 34 additions and 17 deletions
@@ -16,12 +16,19 @@ export default class SecurityClient {
const req = new Request(resource, options);
if (this.#token == '') {
this.setToken(await token());
try {
// TODO: This should be moved to a context to do it only once when app loads
// this try catch saves route guard from a stuck state
this.setToken(await token());
} catch (error) {
console.error("Unauthorized access");
}
}
if (this.#token) {
req.headers.set('Authorization', 'Bearer ' + this.#token);
return fetch(req);
}
return fetch(req);
}
}