1.0.12 • Published 10 months ago

@foxpage/foxpage-api-handler v1.0.12

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

背景

toast 展示信息空间较少,覆盖了后端的错误详情,难以提供更加准确的信息

问题

errorToast 函数,错误信息通过前端定义,基本没有用到后端的返回结果

前端现有文案

Error CodeDescription
fetchListFailed
deleteContentFailed删除失败,此${type}正在被使用
obtainFailed获取动态,mock
uploadFailed
deleteFailed
updateFailed
fetchFailed
saveFailed
publishFailed
offlineFailed下线
liveFailed激活
previewFailed
fetchUpdateInfoFailed
saveResourceFiled
saveComponentFiled
copyFailed
commitFailed上架
revokeFailed下架
fetchDetailFailed
addFailed
fetchPageListFailed
checkFailed
lockFailed
unlockFailed
searchFailed
cloneFailed
disabledFailed禁用
fetchComponentVersionResourceInfoFailed查询组件版本资源信息失败
fetchMockFailed
parsePageFailed
fetchTemplateFailed
fetchCatalogFailed查询目录失败
fetchHtmlFailed
fetchDslFailed
uploadScreenshotFailed
fetchVersionsFailed历史版本
tagSaveFailed标签同步失败

服务端

接口返回状态码 status 字段由 3 部分组成,动作,模块,数据,结果

在返回的 status 使用常量的方式传入,组合成最终的一个数值结果

动作

{
   "action": {
     "create": "10",
     "update": "11",
     "remove": "12",
     "query": "13",
     "publish": "14",
     "live": "15",
     "offline": "16",
     "clone": "17",
     "purchase": "18",
     "deprecate": "19",
     "sync": "20",
     ...
   }
}

模块

{
  "module": {
    "organization": "01",
    "team": "02",
    "application": "03"
    ...
  }
}

数据

{
  "dataType": {
    "folder": "01",
    "file": "02",
    "content": "03",
    "version": "04",
    "detail": "05",
    "builder": "06",
    "setting": "07",
    "tag": "08",
    ...
  }
}

结果

{
   "result": {
      "success": "01",
      "params-invalid": "02",
      "error": "03",
      "access-deny": "04"
      ...
   }
}

样例

获取应用详情成功:13-03-05-01

更新应用详情失败:11-03-05-03

1.0.11

10 months ago

1.0.12

10 months ago

1.0.10

12 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago