Skip to content

Commit

Permalink
feat(): add get response method to override res object
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Jun 30, 2021
1 parent 52df57a commit 36362ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function createAuthGuard(type?: string | string[]): Type<CanActivate> {
};
const [request, response] = [
this.getRequest(context),
context.switchToHttp().getResponse()
this.getResponse(context)
];
const passportFn = createPassportContext(request, response);
const user = await passportFn(
Expand All @@ -63,6 +63,10 @@ function createAuthGuard(type?: string | string[]): Type<CanActivate> {
return context.switchToHttp().getRequest();
}

getResponse<T = any>(context: ExecutionContext): T {
return context.switchToHttp().getResponse();
}

async logIn<TRequest extends { logIn: Function } = any>(
request: TRequest
): Promise<void> {
Expand Down

0 comments on commit 36362ea

Please sign in to comment.