Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions NorthwindCRUD/Controllers/AuthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public ActionResult<string> Register(RegisterDto userModel)

[AllowAnonymous]
[HttpPost("LoginObject")]
public ActionResult<string> LoginObject(LoginDto userModel)
public ActionResult<AuthDto> LoginObject(LoginDto userModel)
{
try
{
Expand All @@ -102,7 +102,7 @@ public ActionResult<string> 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!");
Expand All @@ -119,7 +119,7 @@ public ActionResult<string> LoginObject(LoginDto userModel)

[AllowAnonymous]
[HttpPost("RegisterObject")]
public ActionResult<string> RegisterObject(RegisterDto userModel)
public ActionResult<AuthDto> RegisterObject(RegisterDto userModel)
{
try
{
Expand All @@ -141,7 +141,7 @@ public ActionResult<string> 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!");
Expand Down
7 changes: 7 additions & 0 deletions NorthwindCRUD/Models/Dtos/AuthDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace NorthwindCRUD.Models.Dtos
{
public class AuthDto
{
public string Token { get; set; }
}
}