package member import ( "net/http" ers "code.30cm.net/digimon/library-go/errors" "app-cloudep-portal-api-gateway/internal/logic/member" "app-cloudep-portal-api-gateway/internal/svc" "app-cloudep-portal-api-gateway/internal/types" "github.com/zeromicro/go-zero/rest/httpx" ) func RefreshAccessTokenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UpdateTokenReq if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, err) return } l := member.NewRefreshAccessTokenLogic(r.Context(), svcCtx) resp, err := l.RefreshAccessToken(&req) if err != nil { e := ers.FromGRPCError(err) httpx.WriteJsonCtx(r.Context(), w, e.HTTPStatus(), types.BaseResponse{ Status: types.Status{ Code: int64(e.FullCode()), Message: e.Error(), }, }) return } else { httpx.OkJsonCtx(r.Context(), w, resp) } } }