@kevisual/api 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/api",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "",
5
5
  "main": "mod.ts",
6
6
  "scripts": {
@@ -18,8 +18,10 @@ export const initApi = async (opts: {
18
18
  const query = item?.api?.query || new Query({ url: item?.api?.url || '/api/router' })
19
19
  const res = await query.post<{ list: RouterItem[] }>({ path: "router", key: 'list', token: token });
20
20
  if (res.code !== 200) {
21
- console.error('初始化路由失败:', query.url, res.message);
22
- return
21
+ return {
22
+ code: res.code,
23
+ message: `初始化路由失败: ${res.message}, url: ${query.url}`
24
+ }
23
25
  }
24
26
  let _list = res.data?.list || []
25
27
  if (opts?.exclude) {
@@ -52,4 +54,8 @@ export const initApi = async (opts: {
52
54
  }).addTo(router);
53
55
  }
54
56
  }
57
+ return {
58
+ code: 200,
59
+ message: '初始化路由成功'
60
+ }
55
61
  }