This commit is contained in:
xmdhs 2023-10-09 21:02:07 +08:00
parent 74fd0902ac
commit eda0d6a4ef
No known key found for this signature in database
GPG Key ID: E809D6D43DEFCC95
2 changed files with 2 additions and 3 deletions

View File

@ -9,7 +9,6 @@ import (
"github.com/xmdhs/authlib-skin/model" "github.com/xmdhs/authlib-skin/model"
"github.com/xmdhs/authlib-skin/service" "github.com/xmdhs/authlib-skin/service"
"github.com/xmdhs/authlib-skin/service/utils"
sutils "github.com/xmdhs/authlib-skin/service/utils" sutils "github.com/xmdhs/authlib-skin/service/utils"
) )
@ -42,7 +41,7 @@ func (h *Handel) handleErrorService(ctx context.Context, w http.ResponseWriter,
h.handleError(ctx, w, err.Error(), model.ErrNotAdmin, 401, slog.LevelDebug) h.handleError(ctx, w, err.Error(), model.ErrNotAdmin, 401, slog.LevelDebug)
return return
} }
if errors.Is(err, utils.ErrTokenInvalid) { if errors.Is(err, sutils.ErrTokenInvalid) {
h.handleError(ctx, w, err.Error(), model.ErrAuth, 401, slog.LevelDebug) h.handleError(ctx, w, err.Error(), model.ErrAuth, 401, slog.LevelDebug)
return return
} }

View File

@ -72,7 +72,7 @@ func (h *Handel) UserInfo() http.HandlerFunc {
t := ctx.Value(tokenKey).(*model.TokenClaims) t := ctx.Value(tokenKey).(*model.TokenClaims)
u, err := h.webService.Info(ctx, t) u, err := h.webService.Info(ctx, t)
if err != nil { if err != nil {
h.handleError(ctx, w, err.Error(), model.ErrService, 500, slog.LevelWarn) h.handleErrorService(ctx, w, err)
return return
} }
encodeJson(w, model.API[model.UserInfo]{ encodeJson(w, model.API[model.UserInfo]{