restore ability to reset the session

This commit is contained in:
Tomek Łaziuk
2018-05-28 22:35:10 +02:00
parent 86fa899b1f
commit d2059dff56
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -213,7 +213,7 @@ declare function session(app: Koa): Koa.Middleware;
declare module "koa" {
interface Context {
session: session.Session | undefined;
session: session.Session | null;
readonly sessionOptions: session.opts | undefined;
}
+7
View File
@@ -39,4 +39,11 @@ app.use(session({
},
}, app));
app.use((ctx, next) => {
// reset the session
ctx.session = null;
return next();
})
app.listen(3000);