添加数据库模板 修缮环境变量
This commit is contained in:
parent
2a3a46ca9c
commit
a480e4b0ca
|
@ -16,7 +16,10 @@ public class UserController(UserManager<ApplicationUser> userManager) : Controll
|
|||
var userId = HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)!.Value;
|
||||
// 获取用户的信息
|
||||
var user = await userManager.FindByIdAsync(userId);
|
||||
|
||||
if (user == null) return BadRequest("用户不存在");
|
||||
//获取role
|
||||
var roles = await userManager.GetRolesAsync(user);
|
||||
|
||||
// 创建一个匿名对象,只包含您想要公开的信息
|
||||
var userInfo = new
|
||||
{
|
||||
|
@ -33,6 +36,7 @@ public class UserController(UserManager<ApplicationUser> userManager) : Controll
|
|||
user.Avatar,
|
||||
user.Desc,
|
||||
user.Posts,
|
||||
Role = roles[0],
|
||||
};
|
||||
|
||||
// 返回用户信息
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
NUXT_API_URL="http://192.168.0.13:5253"
|
||||
NUXT_API_URL="http://127.0.0.1:5253"
|
Loading…
Reference in New Issue