Skip to content

Commit 6803624

Browse files
committed
Pops refresh dialog at 5 min before expiration
1 parent ccaba8b commit 6803624

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/client/src/App.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import Refresh from './components/Refresh';
1717
import useToken from './components/Login/useToken';
1818
var jwt = require('jsonwebtoken');
1919

20+
const REFRESH_POPUP_TIME = 300 // seconds
2021

2122
// Triggers token expiration check
2223
const sleep = time => new Promise(resolve => setTimeout(resolve, time))
@@ -80,7 +81,7 @@ function AuthenticatedApp() {
8081
var expTime = decoded?.payload.exp - Date.now()/1000;
8182
const jwtExpired = expTime <= 0
8283

83-
const popRefreshAlert = expTime > 0 && expTime < 30; // Time in secs to pop up refresh dialog
84+
const popRefreshAlert = expTime > 0 && expTime < REFRESH_POPUP_TIME; // Time in secs to pop up refresh dialog
8485

8586
const hdr = userRole === 'admin' ? <AdminHeader /> : <Header /> // If we're going to display a header, which one?
8687

0 commit comments

Comments
 (0)