blob: 9e5314724ae627bb9091b7b49e49f8a26d1682eb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package users
import (
"net/http"
"github.com/gin-gonic/gin"
)
// GetCurrentUser returns the authenticated user's information
func GetCurrentUser(c *gin.Context) {
// Get user from context (set by auth middleware)
user, exists := c.Get("user")
if !exists {
c.JSON(http.StatusNotFound, gin.H{"error": "User not found"})
return
}
c.JSON(http.StatusOK, gin.H{"user": user})
}
|