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 34d55a0a
authored
Nov 10, 2022
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
v2.0.2
1 parent
e352ac59
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
dist/glsx-common.js
package.json
src/http.js
dist/glsx-common.js
View file @
34d55a0
This diff is collapsed.
Click to expand it.
package.json
View file @
34d55a0
{
{
"name"
:
"glsx-common"
,
"name"
:
"glsx-common"
,
"version"
:
"2.0.
1
"
,
"version"
:
"2.0.
2
"
,
"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 @
34d55a0
...
@@ -52,14 +52,20 @@ Http.prototype.create = function () {
...
@@ -52,14 +52,20 @@ Http.prototype.create = function () {
({
data
:
res
,
config
:
{
returnAll
}
})
=>
{
({
data
:
res
,
config
:
{
returnAll
}
})
=>
{
const
{
const
{
response
:
{
code_key
,
errId
=
'errId'
,
code_success_value
=
'0'
,
data_key
=
'data'
,
errId_logout_value
,
logout_function
=
'logout'
},
response
:
{
code_key
,
errId
=
'errId'
,
code_success_value
=
'0'
,
data_key
=
'data'
,
errId_logout_value
,
logout_function
=
'logout'
},
alert
alert
=
Promise
.
reject
}
=
this
.
customer
}
=
this
.
customer
if
(
returnAll
||
!
alert
)
{
//
if (returnAll || !alert) {
return
res
//
return res
}
//
}
let
codekey
=
Array
.
isArray
(
code_key
)
?
code_key
.
find
(
key
=>
res
.
hasOwnProperty
(
key
))
:
code_key
let
codekey
=
Array
.
isArray
(
code_key
)
?
code_key
.
find
(
key
=>
res
.
hasOwnProperty
(
key
))
:
code_key
let
code
=
res
[
codekey
]
let
code
=
res
[
codekey
]
let
errValue
=
res
[
errId
]
let
errValue
=
res
[
errId
]
if
(
returnAll
)
{
if
(
code
==
errId_logout_value
||
(
errValue
&&
errValue
==
errId_logout_value
))
{
logout
(
logout_function
)
}
return
res
}
// 特殊的code处理,可以增加
// 特殊的code处理,可以增加
switch
(
code
+
''
)
{
switch
(
code
+
''
)
{
case
code_success_value
+
''
:
case
code_success_value
+
''
:
...
...
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