@foal/core
Version:
Full-featured Node.js framework, with no complexity
17 lines (16 loc) • 471 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.readSession = readSession;
const session_1 = require("./session");
async function readSession(store, id) {
const state = await store.read(id);
if (state === null) {
return null;
}
const session = new session_1.Session(store, state, { exists: true });
if (session.isExpired) {
await session.destroy();
return null;
}
return session;
}