Skip to content

Commit

Permalink
fix refresh req on visibility change
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-madlani committed Feb 8, 2025
1 parent b6e84af commit e703bec
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { useTourProvider } from '../../context/TourProvider/TourProvider';
import { CurrentTourPageType } from '../../enums/tour.enum';
import { useApplicationStore } from '../../hooks/useApplicationStore';
import useCustomLocation from '../../hooks/useCustomLocation/useCustomLocation';
import TokenService from '../../utils/Auth/TokenService/TokenServiceUtil';
import {
extractDetailsFromToken,
isProtectedRoute,
Expand All @@ -38,8 +39,7 @@ const Appbar: React.FC = (): JSX.Element => {
const { isTourOpen, updateTourPage, updateTourSearch, tourSearchValue } =
useTourProvider();

const { isAuthenticated, searchCriteria, trySilentSignIn } =
useApplicationStore();
const { isAuthenticated, searchCriteria } = useApplicationStore();

const parsedQueryString = Qs.parse(
location.search.startsWith('?')
Expand Down Expand Up @@ -126,7 +126,7 @@ const Appbar: React.FC = (): JSX.Element => {
const { isExpired } = extractDetailsFromToken(getOidcToken());
if (!document.hidden && isExpired) {
// force logout
trySilentSignIn(true);
TokenService.getInstance().refreshToken();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export interface ApplicationStore
entityDetails: EntityUnion;
}) => void;
updateSearchCriteria: (criteria: ExploreSearchIndex | '') => void;
trySilentSignIn: (forceLogout?: boolean) => void;
setApplicationsName: (applications: string[]) => void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ export const extractDetailsFromToken = (token: string) => {
return {
exp: 0,
isExpired: true,

timeoutExpiry: 0,
};
};
Expand Down

0 comments on commit e703bec

Please sign in to comment.