@liujitcn/kratos-uni-app-core 0.0.99 → 0.1.1
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 +3 -3
- package/src/utils/http.ts +11 -1
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git@github.com:liujitcn/kratos-admin.git"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.1.1",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@dcloudio/uni-app": "3.0.0-
|
|
45
|
+
"@dcloudio/uni-app": "3.0.0-alpha-5030320261021002",
|
|
46
46
|
"@dcloudio/uni-ui": "^1.4.28",
|
|
47
|
-
"@dcloudio/vite-plugin-uni": "3.0.0-
|
|
47
|
+
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-5030320261021002",
|
|
48
48
|
"asmcrypto.js": "^2.3.2",
|
|
49
49
|
"go-captcha-uni": "1.0.6",
|
|
50
50
|
"pinia": "^2.0.27",
|
package/src/utils/http.ts
CHANGED
|
@@ -405,7 +405,14 @@ const RELOGIN_PROMPT_TIMEOUT = 60_000
|
|
|
405
405
|
async function promptRelogin() {
|
|
406
406
|
// 401 来自旧会话的在途请求而当前已是有效登录态时直接忽略,避免刚登录成功被弹窗打断。
|
|
407
407
|
if (hasValidToken()) {
|
|
408
|
-
|
|
408
|
+
// 本地令牌未过期但服务端已判定失效时,先强制续签一次;续签成功即静默恢复,
|
|
409
|
+
// 续签失败清空残留登录态后继续弹窗,避免停留在“本地有效”的假登录态。
|
|
410
|
+
try {
|
|
411
|
+
await handleTokenRefresh()
|
|
412
|
+
return
|
|
413
|
+
} catch {
|
|
414
|
+
silentClearAuthData()
|
|
415
|
+
}
|
|
409
416
|
}
|
|
410
417
|
const pages = getCurrentPages()
|
|
411
418
|
if (pages[pages.length - 1]?.route === 'pages/login/login') {
|
|
@@ -435,6 +442,9 @@ async function promptRelogin() {
|
|
|
435
442
|
])
|
|
436
443
|
|
|
437
444
|
if (!modalRes?.confirm) {
|
|
445
|
+
// 用户关闭提示或超时未确认时也要完成登出,避免残留“本地有效”的假登录态
|
|
446
|
+
// 导致后续请求全部 401 被静默吞掉、界面看起来像按钮失灵。
|
|
447
|
+
await clearUserData()
|
|
438
448
|
return
|
|
439
449
|
}
|
|
440
450
|
|