package api

import (
	"github.com/gin-gonic/gin"
	"wireguard-ui/http/response"
	"wireguard-ui/http/vo"
)

// GetCurrentLoginUser
// @description: 获取当前登陆用户
// @param c
// @return *vo.User
func GetCurrentLoginUser(c *gin.Context) *vo.User {
	if user, ok := c.Get("user"); ok {
		return user.(*vo.User)
	}
	response.R(c).AuthorizationFailed("暂未登陆")
	c.Abort()
	return nil
}
