File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public ActionResult<string> Register(RegisterDto userModel)
9292
9393 [ AllowAnonymous ]
9494 [ HttpPost ( "LoginObject" ) ]
95- public ActionResult < string > LoginObject ( LoginDto userModel )
95+ public ActionResult < AuthDto > LoginObject ( LoginDto userModel )
9696 {
9797 try
9898 {
@@ -102,7 +102,7 @@ public ActionResult<string> LoginObject(LoginDto userModel)
102102 {
103103 var token = this . authService . GenerateJwtToken ( userModel . Email ) ;
104104
105- return Ok ( new { token } ) ;
105+ return Ok ( new AuthDto ( ) { Token = token } ) ;
106106 }
107107
108108 return BadRequest ( "Email or password are not correct!" ) ;
@@ -119,7 +119,7 @@ public ActionResult<string> LoginObject(LoginDto userModel)
119119
120120 [ AllowAnonymous ]
121121 [ HttpPost ( "RegisterObject" ) ]
122- public ActionResult < string > RegisterObject ( RegisterDto userModel )
122+ public ActionResult < AuthDto > RegisterObject ( RegisterDto userModel )
123123 {
124124 try
125125 {
@@ -141,7 +141,7 @@ public ActionResult<string> RegisterObject(RegisterDto userModel)
141141 if ( user != null )
142142 {
143143 var token = this . authService . GenerateJwtToken ( user . Email ) ;
144- return Ok ( new { token } ) ;
144+ return Ok ( new AuthDto ( ) { Token = token } ) ;
145145 }
146146
147147 return BadRequest ( "Email or password are not correct!" ) ;
Original file line number Diff line number Diff line change 1+ namespace NorthwindCRUD . Models . Dtos
2+ {
3+ public class AuthDto
4+ {
5+ public string Token { get ; set ; }
6+ }
7+ }
You can’t perform that action at this time.
0 commit comments