@peng_kai/kit 0.3.0-beta.29 → 0.3.0-beta.30

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.
@@ -37,7 +37,7 @@ export function createAdminPermission(roles: TRoles) {
37
37
  return _codes.every(code => !!_permissionCodes[code]);
38
38
  };
39
39
 
40
- watch(role, refreshPermission, { immediate: true });
40
+ watch(role, refreshPermission);
41
41
 
42
42
  return reactive({
43
43
  codes: readonly(permissionCodes),
@@ -12,15 +12,21 @@ export function setupPermissionRouterGuard(
12
12
  rouneNames: { index: string, login: string, 403: string },
13
13
  ) {
14
14
  router.beforeEach(async (to, _, next) => {
15
- const isLogin = hasToken();
15
+ let isLogin = hasToken();
16
16
  const needLogin = Boolean(to.meta?.requireAuth);
17
17
  let hasPermission = false;
18
18
 
19
19
  if (isLogin) {
20
- await permission?.refresh();
21
-
22
- const permissionCode = to.meta?.permissionCode;
23
- hasPermission = permissionCode ? (permission?.has(permissionCode) ?? true) : true;
20
+ try {
21
+ await permission?.refresh();
22
+ const permissionCode = to.meta?.permissionCode;
23
+ hasPermission = permissionCode ? (permission?.has(permissionCode) ?? true) : true;
24
+ }
25
+ catch (err) {
26
+ console.error('🤡 获取权限错误:', err);
27
+ isLogin = false;
28
+ hasPermission = false;
29
+ }
24
30
  }
25
31
 
26
32
  // 已登录状态跳转登录页,跳转至首页
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peng_kai/kit",
3
3
  "type": "module",
4
- "version": "0.3.0-beta.29",
4
+ "version": "0.3.0-beta.30",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "peerDependencies": {
16
16
  "ant-design-vue": "4.2.6",
17
- "vue": "3.5.21",
18
- "vue-router": "4.5.1"
17
+ "vue": "3.5.26",
18
+ "vue-router": "4.6.4"
19
19
  },
20
20
  "dependencies": {
21
21
  "@aws-sdk/client-s3": "^3.891.0",
@@ -25,17 +25,17 @@
25
25
  "@babel/traverse": "^7.28.4",
26
26
  "@babel/types": "^7.28.4",
27
27
  "@ckeditor/ckeditor5-vue": "^7.3.0",
28
- "@fingerprintjs/fingerprintjs": "^4.6.2",
29
- "@tanstack/vue-query": "^5.89.0",
30
- "@vueuse/components": "^13.9.0",
31
- "@vueuse/core": "^13.9.0",
32
- "@vueuse/router": "^13.9.0",
28
+ "@fingerprintjs/fingerprintjs": "^5.0.1",
29
+ "@tanstack/vue-query": "^5.92.5",
30
+ "@vueuse/components": "^14.1.0",
31
+ "@vueuse/core": "^14.1.0",
32
+ "@vueuse/router": "^14.1.0",
33
33
  "archiver": "^7.0.1",
34
- "axios": "^1.12.2",
34
+ "axios": "^1.13.2",
35
35
  "bignumber.js": "^9.3.1",
36
36
  "chokidar": "^4.0.3",
37
37
  "crypto-es": "^3.1.2",
38
- "dayjs": "^1.11.18",
38
+ "dayjs": "^1.11.19",
39
39
  "echarts": "^5.5.1",
40
40
  "execa": "^9.6.0",
41
41
  "fast-glob": "^3.3.3",
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@peng_kai/lint": "^0.1.0",
54
- "@types/archiver": "^6.0.3",
54
+ "@types/archiver": "^7.0.0",
55
55
  "@types/crypto-js": "^4.2.2",
56
56
  "@types/lodash-es": "^4.17.12",
57
57
  "@types/node": "^22.18.5",