Fix: emby me api return is login

pull/47/head
zijiren233 2 years ago
parent 2665ebddbf
commit 62a86eaadf

@ -1,9 +1,11 @@
package vendorEmby
import (
"errors"
"net/http"
"github.com/gin-gonic/gin"
"github.com/synctv-org/synctv/internal/db"
"github.com/synctv-org/synctv/internal/op"
"github.com/synctv-org/synctv/internal/vendor"
"github.com/synctv-org/synctv/server/model"
@ -17,6 +19,12 @@ func Me(ctx *gin.Context) {
eucd, err := user.EmbyCache().Get(ctx)
if err != nil {
if errors.Is(err, db.ErrNotFound("vendor")) {
ctx.JSON(http.StatusOK, model.NewApiDataResp(&EmbyMeResp{
IsLogin: false,
}))
return
}
ctx.AbortWithStatusJSON(http.StatusInternalServerError, model.NewApiErrorResp(err))
return
}
@ -26,7 +34,7 @@ func Me(ctx *gin.Context) {
Token: eucd.ApiKey,
})
if err != nil {
ctx.AbortWithStatusJSON(http.StatusBadRequest, model.NewApiErrorResp(err))
ctx.AbortWithStatusJSON(http.StatusInternalServerError, model.NewApiErrorResp(err))
return
}

Loading…
Cancel
Save