feat: add profile page

This commit is contained in:
2026-06-24 10:58:51 +03:00
parent 4fc2c28d3b
commit a450f32272
2 changed files with 14 additions and 0 deletions
+13
View File
@@ -161,3 +161,16 @@ func UpdateProfile(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "Данные успешно обновлены"})
}
func GetUserInfo(c *gin.Context) {
userID := c.MustGet("user_id")
var user models.User
if err := database.DB.First(&user, userID).Error; err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Ошибка при получение профиля"})
return
}
c.JSON(http.StatusOK, user)
}