Mercurial > gemma
comparison 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 |
comparison
equal
deleted
inserted
replaced
161:b7ac2e4f9c5c | 162:9908260d1e6a |
---|---|
1 function sessionStillActive(expiresFromPastSession) { | |
2 if (!expiresFromPastSession) return false; | |
3 const now = Date.now(); | |
4 const sessionEnd = expiresFromPastSession; | |
5 const stillActive = now < sessionEnd; | |
6 return stillActive; | |
7 } | |
8 | |
9 export { sessionStillActive }; |