Se agregaron los campos de los que se deben de mandar a origen de usuario
This commit is contained in:
@@ -8,19 +8,22 @@ import { ApiBearerAuth } from '@nestjs/swagger';
|
||||
|
||||
@Controller()
|
||||
export class AuthController {
|
||||
constructor(private readonly authService: AuthService) {}
|
||||
constructor(private readonly authService: AuthService) { }
|
||||
|
||||
@Post('login')
|
||||
@AuthDocumentation.login()
|
||||
async login(@Body() dto: LoginDto) {
|
||||
const user = await this.authService.validateUser(dto.email, dto.password);
|
||||
if (!user) {
|
||||
throw new Error('Invalid credentials');
|
||||
}
|
||||
return this.authService.login(user);
|
||||
}
|
||||
|
||||
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@ApiBearerAuth('bearer')
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Get('profile')
|
||||
@AuthDocumentation.bearerAuth()
|
||||
getProfile(@Request() req) {
|
||||
@@ -34,7 +37,7 @@ export class AuthController {
|
||||
|
||||
|
||||
|
||||
@Post('register')
|
||||
@Post('register')
|
||||
@AuthDocumentation.register() // ver siguiente sección
|
||||
async register(@Body() dto: RegisterDto) {
|
||||
return this.authService.register(dto);
|
||||
|
||||
Reference in New Issue
Block a user