Skip to content

Commit

Permalink
fix session expiry detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 committed Oct 19, 2023
1 parent 6ee8422 commit 5c30cab
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Redux/fireRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,15 @@ export const fireRequest = (
const config: any = {
headers: {},
};
if (!request.noAuth && localStorage.getItem(LocalStorageKeys.accessToken)) {
config.headers["Authorization"] =
"Bearer " + localStorage.getItem(LocalStorageKeys.accessToken);
} else {
// TODO: get access token
if (!request.noAuth) {
const access_token = localStorage.getItem(LocalStorageKeys.accessToken);
if (access_token) {
config.headers["Authorization"] = "Bearer " + access_token;
} else {
// We do not have access token, so we need to redirect to session expired page
window.location.href = "/session-expired";
return;
}
}
const axiosApiCall: any = axios.create(config);

Expand Down

0 comments on commit 5c30cab

Please sign in to comment.