Mercurial > gemma
diff client/src/lib/session.js @ 162:9908260d1e6a
Refactor: Login expiry refactored to lib
test: First unit test for session
Cleaned up Code regarding expired sessions.
First unit test established for session mostly for educational
purposes.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 05 Jul 2018 18:01:39 +0200 |
parents | |
children | 30c212a6f580 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/lib/session.js Thu Jul 05 18:01:39 2018 +0200 @@ -0,0 +1,9 @@ +function sessionStillActive(expiresFromPastSession) { + if (!expiresFromPastSession) return false; + const now = Date.now(); + const sessionEnd = expiresFromPastSession; + const stillActive = now < sessionEnd; + return stillActive; +} + +export { sessionStillActive };