apps/web: fix logout error

This commit is contained in:
vchikalkin 2022-12-16 18:37:04 +03:00
parent 87e7bd1b4a
commit 9b35854864

View File

@ -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');
}