diff --git a/NorthwindCRUD/Controllers/AuthController.cs b/NorthwindCRUD/Controllers/AuthController.cs index 36503a4..6c27411 100644 --- a/NorthwindCRUD/Controllers/AuthController.cs +++ b/NorthwindCRUD/Controllers/AuthController.cs @@ -92,7 +92,7 @@ public ActionResult Register(RegisterDto userModel) [AllowAnonymous] [HttpPost("LoginObject")] - public ActionResult LoginObject(LoginDto userModel) + public ActionResult LoginObject(LoginDto userModel) { try { @@ -102,7 +102,7 @@ public ActionResult LoginObject(LoginDto userModel) { var token = this.authService.GenerateJwtToken(userModel.Email); - return Ok(new { token }); + return Ok(new AuthDto() { Token = token }); } return BadRequest("Email or password are not correct!"); @@ -119,7 +119,7 @@ public ActionResult LoginObject(LoginDto userModel) [AllowAnonymous] [HttpPost("RegisterObject")] - public ActionResult RegisterObject(RegisterDto userModel) + public ActionResult RegisterObject(RegisterDto userModel) { try { @@ -141,7 +141,7 @@ public ActionResult RegisterObject(RegisterDto userModel) if (user != null) { var token = this.authService.GenerateJwtToken(user.Email); - return Ok(new { token }); + return Ok(new AuthDto() { Token = token }); } return BadRequest("Email or password are not correct!"); diff --git a/NorthwindCRUD/Models/Dtos/AuthDto.cs b/NorthwindCRUD/Models/Dtos/AuthDto.cs new file mode 100644 index 0000000..6c470a9 --- /dev/null +++ b/NorthwindCRUD/Models/Dtos/AuthDto.cs @@ -0,0 +1,7 @@ +namespace NorthwindCRUD.Models.Dtos +{ + public class AuthDto + { + public string Token { get; set; } + } +}