From 2b878b224b404293686b45765db7b291d5d3194e Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Tue, 7 May 2019 22:23:57 +0000 Subject: [PATCH] fix: double logout will not result in failures (#2300) --- src/core/server/app/handlers/api/auth/local.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/server/app/handlers/api/auth/local.ts b/src/core/server/app/handlers/api/auth/local.ts index 874e25c75..55e0c5d3d 100644 --- a/src/core/server/app/handlers/api/auth/local.ts +++ b/src/core/server/app/handlers/api/auth/local.ts @@ -107,9 +107,8 @@ export const logoutHandler = ({ // Get the user on the request. const user = req.user; if (!user) { - return next( - new Error("cannot logout when there is no user on the request") - ); + // If a user is already logged out, then there's no need to do it again! + return res.sendStatus(204); } // Delegate to the logout handler.