Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
npm
/
glsx-common
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f8a0ed11
authored
Nov 01, 2021
by
limin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
兼容多个codekey
1 parent
efefd45f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
package.json
src/http.js
package.json
View file @
f8a0ed1
{
{
"name"
:
"glsx-common"
,
"name"
:
"glsx-common"
,
"version"
:
"1.4.
6
"
,
"version"
:
"1.4.
7
"
,
"description"
:
"glsx common"
,
"description"
:
"glsx common"
,
"main"
:
"./dist/glsx-common.js"
,
"main"
:
"./dist/glsx-common.js"
,
"private"
:
false
,
"private"
:
false
,
...
...
src/http.js
View file @
f8a0ed1
...
@@ -47,13 +47,14 @@ Http.prototype.create = function () {
...
@@ -47,13 +47,14 @@ Http.prototype.create = function () {
this
.
service
.
interceptors
.
response
.
use
(
this
.
service
.
interceptors
.
response
.
use
(
({
data
:
res
,
config
:
{
returnAll
}
})
=>
{
({
data
:
res
,
config
:
{
returnAll
}
})
=>
{
const
{
const
{
response
:
{
code_key
=
'code'
,
errId
=
'errId'
,
code_success_value
=
'0'
,
data_key
=
'data'
,
errId_logout_value
},
response
:
{
code_key
,
errId
=
'errId'
,
code_success_value
=
'0'
,
data_key
=
'data'
,
errId_logout_value
},
alert
alert
}
=
this
.
customer
}
=
this
.
customer
if
(
returnAll
||
!
alert
)
{
if
(
returnAll
||
!
alert
)
{
return
res
return
res
}
}
let
code
=
res
[
code_key
]
let
codekey
=
Array
.
isArray
(
code_key
)
?
code_key
.
find
(
key
=>
res
.
hasOwnProperty
(
key
))
:
code_key
let
code
=
res
[
codekey
]
let
errValue
=
res
[
errId
]
let
errValue
=
res
[
errId
]
// 特殊的code处理,可以增加
// 特殊的code处理,可以增加
switch
(
code
+
''
)
{
switch
(
code
+
''
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment