diff --git a/config/auth/middleware/getCurrentUser.ts b/config/auth/middleware/getCurrentUser.ts index 6fad42d..072a4a1 100644 --- a/config/auth/middleware/getCurrentUser.ts +++ b/config/auth/middleware/getCurrentUser.ts @@ -19,7 +19,7 @@ const getCurrentUser = async ( } req.user = user; - next(); + await next(); }; export default getCurrentUser; diff --git a/pages/api/users/login.ts b/pages/api/users/login.ts index ebf784e..29163a4 100644 --- a/pages/api/users/login.ts +++ b/pages/api/users/login.ts @@ -15,7 +15,7 @@ export default nextConnect< NextApiResponse> >(NextConnectConfig) .use(passport.initialize()) - .use(async (req, res, next) => { + .use((req, res, next) => { const parsed = LoginValidationSchema.safeParse(req.body); if (!parsed.success) { throw new ServerError('Username and password are required.', 400);