From 36362eabdf798219315cd94ba45974e7623f4299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20My=C5=9Bliwiec?= Date: Wed, 30 Jun 2021 13:40:22 +0200 Subject: [PATCH] feat(): add get response method to override res object --- lib/auth.guard.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/auth.guard.ts b/lib/auth.guard.ts index 80de945f..a7f4ed2b 100644 --- a/lib/auth.guard.ts +++ b/lib/auth.guard.ts @@ -46,7 +46,7 @@ function createAuthGuard(type?: string | string[]): Type { }; const [request, response] = [ this.getRequest(context), - context.switchToHttp().getResponse() + this.getResponse(context) ]; const passportFn = createPassportContext(request, response); const user = await passportFn( @@ -63,6 +63,10 @@ function createAuthGuard(type?: string | string[]): Type { return context.switchToHttp().getRequest(); } + getResponse(context: ExecutionContext): T { + return context.switchToHttp().getResponse(); + } + async logIn( request: TRequest ): Promise {