28 lines
351 B
Go

package utils
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
)
// GetUser ...
func GetUser(ctx *aero.Context) *arn.User {
if !ctx.HasSession() {
return nil
}
userID := ctx.Session().GetString("userId")
if userID == "" {
return nil
}
user, err := arn.GetUser(userID)
if err != nil {
return nil
}
return user
}