Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sys-sdk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
sys-sdk
Commits
83c876f1
Commit
83c876f1
authored
Dec 20, 2023
by
guang.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 解决刷新token失败后不弹框问题
parent
8c7bdd80
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
http.js
lib/http.js
+5
-5
package.json
package.json
+1
-1
No files found.
lib/http.js
View file @
83c876f1
...
@@ -135,12 +135,12 @@ const refreshTokenTimeOut = debounce(() => {
...
@@ -135,12 +135,12 @@ const refreshTokenTimeOut = debounce(() => {
* 未超过5小时,弹窗提示跳转新标签页登录
* 未超过5小时,弹窗提示跳转新标签页登录
* **/
* **/
const
showLoginPopups
=
debounce
(()
=>
{
const
showLoginPopups
=
debounce
(()
=>
{
let
href
=
window
.
location
.
href
;
href
=
href
.
replace
(
/
\?
token=
[
a-z0-9
\-
A-Z
]
+/g
,
''
);
href
=
instance
.
_extend
.
loginUrl
+
'
?url=
'
+
window
.
btoa
(
href
);
if
(
checkTokenTimeOut5Hours
()
||
!
instance
.
_extend
.
modal
)
{
if
(
checkTokenTimeOut5Hours
()
||
!
instance
.
_extend
.
modal
)
{
window
.
location
.
href
=
instance
.
_extend
.
loginUrl
+
'
?url=
'
+
window
.
btoa
(
href
)
;
window
.
location
.
href
=
href
;
}
else
{
}
else
{
let
href
=
window
.
location
.
href
;
href
=
href
.
replace
(
/
\?
token=
[
a-z0-9
\-
A-Z
]
+/g
,
''
);
href
=
instance
.
_extend
.
loginUrl
+
'
?url=
'
+
window
.
btoa
(
href
);
instance
.
_extend
.
modal
.
confirm
({
instance
.
_extend
.
modal
.
confirm
({
title
:
'
会话过期
'
,
title
:
'
会话过期
'
,
content
:
'
当前会话已过期,请重新登录。
'
,
content
:
'
当前会话已过期,请重新登录。
'
,
...
@@ -236,7 +236,7 @@ instance.interceptors.response.use(
...
@@ -236,7 +236,7 @@ instance.interceptors.response.use(
// token过期;
// token过期;
return
refreshRequest
(
response
.
config
);
return
refreshRequest
(
response
.
config
);
}
}
if
(
+
code
===
4010
||
+
code
===
4011
)
{
if
(
+
code
===
4010
||
+
code
===
4011
||
(
code
===
'
0001
'
&&
response
.
url
.
indexOf
(
'
oauth/refreshtoken
'
)
>
-
1
)
)
{
showLoginPopups
();
showLoginPopups
();
return
;
return
;
}
}
...
...
package.json
View file @
83c876f1
{
{
"name"
:
"@qg/sys-sdk"
,
"name"
:
"@qg/sys-sdk"
,
"version"
:
"1.0.2
2
"
,
"version"
:
"1.0.2
3
"
,
"description"
:
""
,
"description"
:
""
,
"main"
:
"index.js"
,
"main"
:
"index.js"
,
"scripts"
:
{
"scripts"
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment