26 lines
525 B
Go
26 lines
525 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
|
|
func (s *Server) GetAuthenticatedUserHandlerV2(ctx *gin.Context) {
|
|
user := s.deps.UserService.GetAuthenicatedUser(ctx)
|
|
if user == nil {
|
|
ctx.JSON(http.StatusUnauthorized, gin.H{
|
|
"status": http.StatusUnauthorized,
|
|
"message": "[UNAUTHORIZED] Could not fetch authenticated user.",
|
|
})
|
|
return
|
|
}
|
|
|
|
ctx.JSON(http.StatusOK, gin.H{
|
|
"status": http.StatusOK,
|
|
"message": "[OK] Successfully retrieved authenticated user.",
|
|
"user": user,
|
|
})
|
|
}
|