From 3ed7ce1d83c0168e71c4dcfcf8e7536bd4d24e3f Mon Sep 17 00:00:00 2001 From: wajeht <58354193+wajeht@users.noreply.github.com> Date: Sun, 5 Jan 2025 22:53:13 -0600 Subject: [PATCH] refactor(middlewares): Rearrange setting user and saving session for clarity --- src/middlewares.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middlewares.ts b/src/middlewares.ts index 25a1ca48..59d28e27 100644 --- a/src/middlewares.ts +++ b/src/middlewares.ts @@ -243,9 +243,9 @@ export async function authenticationMiddleware(req: Request, res: Response, next return res.redirect('/login'); } + req.user = user; req.session.user = user; req.session.save(); - req.user = user; next(); } catch (error) {