Commit c41dad1b by limin

1.4.8

1 parent f8a0ed11
{ {
"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,
......
...@@ -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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!