main
nilo 2024-11-24 16:02:01 -03:00
parent 25d3e86d38
commit 1735361441
1 changed files with 5 additions and 1 deletions

View File

@ -132,7 +132,11 @@ func AddUser(c *fiber.Ctx) error {
// MARK: GetOwnUser
func GetOwnUser(c *fiber.Ctx) error {
user := c.Locals("user").(models.User)
user, ok := c.Locals("user").(models.User)
if !ok {
return fiber.NewError(fiber.StatusUnauthorized, "Unauthorized: User is not admin")
}
return c.JSON(user)
}