From 1a918ddf6461d69d14e1225889587e112c603414 Mon Sep 17 00:00:00 2001 From: Trivernis Date: Tue, 29 Oct 2019 11:01:19 +0100 Subject: [PATCH] Fixed logout error --- src/graphql/resolvers.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/graphql/resolvers.ts b/src/graphql/resolvers.ts index 44ea21d..4fa7f1f 100644 --- a/src/graphql/resolvers.ts +++ b/src/graphql/resolvers.ts @@ -87,8 +87,14 @@ export function resolver(req: any, res: any): any { } }, logout() { - if (req.session.user) { - delete req.session.user; + if (req.session.userId) { + delete req.session.userId; + req.session.save((err: any) => { + if (err) { + globals.logger.error(err.message); + globals.logger.debug(err.stack); + } + }); return true; } else { res.status(status.UNAUTHORIZED);