Skip to content

Commit

Permalink
Merge pull request #25 from bcgov/fix/async-bug
Browse files Browse the repository at this point in the history
fixing async bug
  • Loading branch information
hannah-macdonald1 authored Nov 5, 2024
2 parents c9757b4 + ac9c0b2 commit a0c3023
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/common/guards/auth/auth.guard.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { Observable } from 'rxjs';
import { AuthService } from './auth.service';

@Injectable()
Expand All @@ -13,14 +12,12 @@ export class AuthGuard implements CanActivate {
this.skip = this.configService.get('skipAuthGuard');
}

canActivate(
context: ExecutionContext,
): boolean | Promise<boolean> | Observable<boolean> {
async canActivate(context: ExecutionContext): Promise<boolean> {
if (this.skip) {
// skip for local development
return true;
}
const request = context.switchToHttp().getRequest();
return this.authService.getRecordAndValidate(request);
return await this.authService.getRecordAndValidate(request);
}
}

0 comments on commit a0c3023

Please sign in to comment.