Skip to content

Commit

Permalink
fix: disable token refresh in cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Aug 12, 2022
1 parent 635cf37 commit eadcff2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions _src/react-app/hooks/useAuthentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ export default function useAuthentication() {
sendTokenToServiceWorker(response.token);
expireTime = response.expirationTime;

intervalId = setInterval(async () => {
if (Date.now() > expireTime) {
console.log('refreshing token');
const response = await result.user.getIdTokenResult();
expireTime = response.expirationTime;
sendTokenToServiceWorker(response.token);
}
}, config.authTokenCheckInterval);
if (!window.Cypress) {
intervalId = setInterval(async () => {
if (Date.now() > expireTime) {
console.log('refreshing token');
const response = await result.user.getIdTokenResult();
expireTime = response.expirationTime;
sendTokenToServiceWorker(response.token);
}
}, config.authTokenCheckInterval);
}

setUser(result.user);
} else {
Expand Down

0 comments on commit eadcff2

Please sign in to comment.