@@ -246,8 +246,8 @@ import { AuthService } from './auth.service';
246
246
@Dependencies (AuthService )
247
247
export class LocalStrategy extends PassportStrategy (Strategy ) {
248
248
constructor (authService ) {
249
- this .authService = authService
250
249
super ();
250
+ this .authService = authService ;
251
251
}
252
252
253
253
async validate(username , password ) {
@@ -345,7 +345,7 @@ import { AuthGuard } from '@nestjs/passport';
345
345
export class AppController {
346
346
@UseGuards (AuthGuard (' local' ))
347
347
@Post (' auth/login' )
348
- @Bind (Req ())
348
+ @Bind (Request ())
349
349
async login(req ) {
350
350
return req .user ;
351
351
}
@@ -446,8 +446,7 @@ import { JwtService } from '@nestjs/jwt';
446
446
@Dependencies (UsersService , JwtService )
447
447
@Injectable ()
448
448
export class AuthService {
449
- constructor (usersService , jwtService )
450
- ) {
449
+ constructor (usersService , jwtService ) {
451
450
this .usersService = usersService ;
452
451
this .jwtService = jwtService ;
453
452
}
@@ -571,7 +570,7 @@ export class AppController {
571
570
572
571
@UseGuards (LocalAuthGuard )
573
572
@Post (' auth/login' )
574
- @Bind (Req ())
573
+ @Bind (Request ())
575
574
async login(req ) {
576
575
return this .authService .login (req .user );
577
576
}
@@ -740,25 +739,28 @@ export class AppController {
740
739
}
741
740
}
742
741
@@switch
743
- import { Controller , Bind , Get , Request , Post , UseGuards } from ' @nestjs/common' ;
742
+ import { Controller , Dependencies , Bind , Get , Request , Post , UseGuards } from ' @nestjs/common' ;
744
743
import { JwtAuthGuard } from ' ./auth/jwt-auth.guard' ;
745
744
import { LocalAuthGuard } from ' ./auth/local-auth.guard' ;
746
745
import { AuthService } from ' ./auth/auth.service' ;
747
746
747
+ @Dependencies (AuthService )
748
748
@Controller ()
749
749
export class AppController {
750
- constructor (private authService : AuthService ) {}
750
+ constructor (authService ) {
751
+ this .authService = authService ;
752
+ }
751
753
752
754
@UseGuards (LocalAuthGuard )
753
755
@Post (' auth/login' )
754
- @Bind (Req ())
756
+ @Bind (Request ())
755
757
async login(req ) {
756
758
return this .authService .login (req .user );
757
759
}
758
760
759
761
@UseGuards (JwtAuthGuard )
760
762
@Get (' profile' )
761
- @Bind (Req ())
763
+ @Bind (Request ())
762
764
getProfile(req ) {
763
765
return req .user ;
764
766
}
0 commit comments