Skip to content

Commit

Permalink
force refresh token
Browse files Browse the repository at this point in the history
  • Loading branch information
tdameros committed Mar 12, 2024
1 parent 6200f0e commit ead0079
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions front/app/src/js/utils/api/BaseClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ export class BaseApiClient {
headers['Authorization'] = this.accessToken.jwt;
const response = await JSONRequests.get(url, params, headers);
if (response.status === 401) {
const auth = await this.authRequired();
if (!auth) {
return {response: {ok: false, status: 401}, body: {}};
}
await this.refreshAccessToken();
return await JSONRequests.get(url, params, headers);
}
return response;
Expand All @@ -138,10 +135,7 @@ export class BaseApiClient {
headers['Authorization'] = this.accessToken.jwt;
const response = await JSONRequests.post(url, body, headers);
if (response.status === 401) {
const auth = await this.authRequired();
if (!auth) {
return {response: {ok: false, status: 401}, body: {}};
}
await this.refreshAccessToken();
return await JSONRequests.post(url, body, headers);
}
return response;
Expand All @@ -155,10 +149,7 @@ export class BaseApiClient {
headers['Authorization'] = this.accessToken.jwt;
const response = await JSONRequests.patch(url, body, headers);
if (response.status === 401) {
const auth = await this.authRequired();
if (!auth) {
return {response: {ok: false, status: 401}, body: {}};
}
await this.refreshAccessToken();
return await JSONRequests.patch(url, body, headers);
}
return response;
Expand All @@ -172,10 +163,7 @@ export class BaseApiClient {
headers['Authorization'] = this.accessToken.jwt;
const response = await JSONRequests.delete(url, params, headers);
if (response.status === 401) {
const auth = await this.authRequired();
if (!auth) {
return {response: {ok: false, status: 401}, body: {}};
}
await this.refreshAccessToken();
return await JSONRequests.delete(url, params, headers);
}
return response;
Expand Down

0 comments on commit ead0079

Please sign in to comment.