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 c41dad1b
authored
Nov 05, 2021
by
limin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.4.8
1 parent
f8a0ed11
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
package.json
src/http.js
package.json
View file @
c41dad1
{
{
"name"
:
"glsx-common"
,
"name"
:
"glsx-common"
,
"version"
:
"1.4.
7
"
,
"version"
:
"1.4.
8
"
,
"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 @
c41dad1
...
@@ -47,7 +47,7 @@ Http.prototype.create = function () {
...
@@ -47,7 +47,7 @@ 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
,
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
,
logout_function
=
'logout'
},
alert
alert
}
=
this
.
customer
}
=
this
.
customer
if
(
returnAll
||
!
alert
)
{
if
(
returnAll
||
!
alert
)
{
...
@@ -61,11 +61,11 @@ Http.prototype.create = function () {
...
@@ -61,11 +61,11 @@ Http.prototype.create = function () {
case
code_success_value
+
''
:
case
code_success_value
+
''
:
break
break
case
errId_logout_value
+
''
:
case
errId_logout_value
+
''
:
logout
()
logout
(
logout_function
)
break
break
default
:
default
:
if
(
errValue
&&
errValue
==
errId_logout_value
)
{
if
(
errValue
&&
errValue
==
errId_logout_value
)
{
logout
(
)
return
logout
(
logout_function
)
}
}
if
(
alert
)
{
if
(
alert
)
{
alert
(
res
.
message
||
res
.
msg
||
'出错了,请联系管理员'
)
alert
(
res
.
message
||
res
.
msg
||
'出错了,请联系管理员'
)
...
@@ -84,7 +84,11 @@ Http.prototype.create = function () {
...
@@ -84,7 +84,11 @@ Http.prototype.create = function () {
this
.
service
.
axios
=
axios
this
.
service
.
axios
=
axios
return
this
.
service
return
this
.
service
}
}
function
logout
()
{
function
logout
(
logout_function
)
{
if
(
window
[
logout_function
])
{
window
[
logout_function
]()
return
}
window
.
history
.
pushState
(
null
,
''
,
'/login'
)
window
.
history
.
pushState
(
null
,
''
,
'/login'
)
}
}
export
default
Http
export
default
Http
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