From 9b3585486457e2e9c59e772e32dd83353c308f71 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 16 Dec 2022 18:37:04 +0300 Subject: [PATCH] apps/web: fix logout error --- apps/api/src/auth/auth.controller.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/api/src/auth/auth.controller.ts b/apps/api/src/auth/auth.controller.ts index e054837..f19e22d 100644 --- a/apps/api/src/auth/auth.controller.ts +++ b/apps/api/src/auth/auth.controller.ts @@ -41,10 +41,10 @@ export class AuthController { @Get('/logout') async logout(@Req() req: FastifyRequest, @Res() reply: FastifyReply) { - this.clearCookies(req, reply); - const token = req.cookies[COOKIE_TOKEN_NAME]; - await this.authService.logout(token); + if (token) await this.authService.logout(token); + + this.clearCookies(req, reply); return reply.status(302).redirect('/login'); }