diff --git a/striker-ui-api/src/lib/request_handlers/auth/logout.ts b/striker-ui-api/src/lib/request_handlers/auth/logout.ts index c6b28e24..a022059d 100644 --- a/striker-ui-api/src/lib/request_handlers/auth/logout.ts +++ b/striker-ui-api/src/lib/request_handlers/auth/logout.ts @@ -1,17 +1,19 @@ import { RequestHandler } from 'express'; +import { cname } from '../../cname'; import { stdout } from '../../shell'; export const logout: RequestHandler = (request, response) => { request.session.destroy((error) => { - let scode = 204; - if (error) { - scode = 500; - stdout(`Failed to destroy session upon logout; CAUSE: ${error}`); + + return response.status(500).send(); } - response.status(scode).send(); + response.clearCookie(cname('user')); + response.clearCookie(cname('sid')); + + return response.status(204).send(); }); };