fix some
This commit is contained in:
parent
74fd0902ac
commit
eda0d6a4ef
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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]{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user