diff --git a/src/vue/api/BootstrapAdmin.Api/Controllers/AccountController.cs b/src/vue/api/BootstrapAdmin.Api/Controllers/AccountController.cs index 3a8f84b1..ec7dcbed 100644 --- a/src/vue/api/BootstrapAdmin.Api/Controllers/AccountController.cs +++ b/src/vue/api/BootstrapAdmin.Api/Controllers/AccountController.cs @@ -6,7 +6,6 @@ using BootstrapAdmin.Api.Authencation; using BootstrapAdmin.Api.Extensions; using BootstrapAdmin.Api.Models; using BootstrapAdmin.Web.Core; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace BootstrapAdmin.Api.Controllers; @@ -14,9 +13,8 @@ namespace BootstrapAdmin.Api.Controllers; /// /// /// -[Route("api/[controller]/[action]")] +[Route("api/[controller]")] [ApiController] -[Authorize] public class AccountController : ControllerBase { private IUser UserService { get; } @@ -32,7 +30,7 @@ public class AccountController : ControllerBase /// /// [HttpPost] - public ActionResult Login([FromServices] IConfiguration configuration, [FromBody] LoginUser user) + public ActionResult Post([FromServices] IConfiguration configuration, [FromBody] LoginUser user) { string? token = null; string? refershtoken = null; @@ -49,12 +47,12 @@ public class AccountController : ControllerBase op.SecurityKey = tokenOption.SecurityKey; }); refershtoken = BootstrapAdminJwtHandler.CreateRefershToken(); - return new LoginResult { Code = "account:200", Message = "login successed!", Token = token, RefershToken = refershtoken }; + return new LoginResult { Code = "0", Message = "login successed!", Result = new Result { Token = token, RefershToken = refershtoken } }; } else { - return new LoginResult { Code = "account:400", Message = "login failed!", Token = token, RefershToken = refershtoken }; + return new LoginResult { Code = "0", Message = "login failed!", Result = new Result { Token = token, RefershToken = refershtoken } }; } } } diff --git a/src/vue/api/BootstrapAdmin.Api/Models/LoginResult.cs b/src/vue/api/BootstrapAdmin.Api/Models/LoginResult.cs index 148217ab..ac1a9d95 100644 --- a/src/vue/api/BootstrapAdmin.Api/Models/LoginResult.cs +++ b/src/vue/api/BootstrapAdmin.Api/Models/LoginResult.cs @@ -22,10 +22,12 @@ public class LoginResult /// /// /// + public Result? Result { get; set; } +} + +public class Result +{ public string? Token { get; set; } - /// - /// - /// public string? RefershToken { get; set; } }