New directory structure
This commit is contained in:
23
utils/user.go
Normal file
23
utils/user.go
Normal file
@ -0,0 +1,23 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
)
|
||||
|
||||
// GetUser ...
|
||||
func GetUser(ctx *aero.Context) *arn.User {
|
||||
userID := ctx.Session().GetString("userId")
|
||||
|
||||
if userID == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
user, err := arn.GetUser(userID)
|
||||
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return user
|
||||
}
|
Reference in New Issue
Block a user