Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2024-08-12 12:42:52 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ba6edb8b6dc4c768c5c7b9f1374f895b67ff9d93
ba6edb8b
1 parent
8714ab45
登陆状态返回402时处理逻辑
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
src/api/fn.js
src/utils/axios.js
src/api/fn.js
View file @
ba6edb8
/*
* @Date: 2022-05-18 22:56:08
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-0
7-27 07:44:0
7
* @LastEditTime: 2024-0
8-12 11:52:4
7
* @FilePath: /data-table/src/api/fn.js
* @Description: 文件描述
*/
...
...
@@ -21,7 +21,7 @@ export const fn = (api) => {
return
res
.
data
||
true
;
}
else
{
// tslint:disable-next-line: no-console
//
if (!res.data.show) return false;
if
(
!
res
.
data
.
show
)
return
false
;
showFailToast
({
message
:
res
.
data
.
msg
,
duration
:
5000
,
...
...
src/utils/axios.js
View file @
ba6edb8
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-28 10:17:40
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 202
2-12-01 16:33:5
1
* @LastEditTime: 202
4-08-12 12:37:1
1
* @FilePath: /data-table/src/utils/axios.js
* @Description:
*/
...
...
@@ -11,6 +11,7 @@ import router from '@/router';
import
qs
from
'Qs'
import
{
strExist
}
from
'@/utils/tools'
// import { parseQueryString } from '@/utils/tools'
import
{
showToast
}
from
'vant'
;
axios
.
defaults
.
params
=
{
f
:
'custom_form'
,
...
...
@@ -43,6 +44,18 @@ axios.interceptors.request.use(
*/
axios
.
interceptors
.
response
.
use
(
response
=>
{
if
(
response
.
data
.
code
===
402
)
{
// 未授权状态
// 特殊标识-带此标识报错不显示
response
.
data
.
show
=
false
;
//
showToast
({
message
:
'登录失效!将跳转到登录页面'
,
duration
:
1500
,
onClose
:
()
=>
{
window
.
location
.
href
=
location
.
origin
+
'/admin/'
;
}
})
}
return
response
;
},
error
=>
{
...
...
Please
register
or
login
to post a comment