You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
399 B
Go

8 months ago
package utils
import (
"errors"
"github.com/exhibition-main/internal/model"
"github.com/exhibition-main/internal/msg"
"github.com/exhibition-main/pkg/jwt"
"github.com/gin-gonic/gin"
)
func GetJwtInfo(ctx *gin.Context) (jwtInfo jwt.MyClaims, err error) {
val, ok := ctx.Get(model.CTX_USER_INFO)
if !ok {
err = errors.New(msg.NEED_LOGIN)
return
}
jwtInfo = val.(jwt.MyClaims)
return
}