From 9001361e4cae1011c9b11a6d09de5e9a37cd21b0 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Sun, 2 Apr 2023 17:23:12 -0700 Subject: [PATCH] Fix session lookup. --- lib/middleware.ts | 2 +- lib/session.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/middleware.ts b/lib/middleware.ts index 039bdac4..b0785e2d 100644 --- a/lib/middleware.ts +++ b/lib/middleware.ts @@ -24,7 +24,7 @@ export const useSession = createMiddleware(async (req, res, next) => { if (!session) { log('useSession: Session not found'); - return badRequest(res); + return badRequest(res, 'Session not found.'); } (req as any).session = session; diff --git a/lib/session.ts b/lib/session.ts index 19c2e405..af9f4c11 100644 --- a/lib/session.ts +++ b/lib/session.ts @@ -62,7 +62,7 @@ export async function findSession(req: NextApiRequestCollect) { } // Find session - let session = await loadSession(websiteId); + let session = await loadSession(sessionId); // Create a session if not found if (!session) {