view 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 source

function sessionStillActive(expiresFromPastSession) {
  if (!expiresFromPastSession) return false;
  const now = Date.now();
  const sessionEnd = expiresFromPastSession;
  const stillActive = now < sessionEnd;
  return stillActive;
}

export { sessionStillActive };