Commit c41dad1b by limin

1.4.8

1 parent f8a0ed11
{
"name": "glsx-common",
"version": "1.4.7",
"version": "1.4.8",
"description": "glsx common",
"main": "./dist/glsx-common.js",
"private": false,
......
......@@ -47,7 +47,7 @@ Http.prototype.create = function () {
this.service.interceptors.response.use(
({ data: res, config: { returnAll } }) => {
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
} = this.customer
if (returnAll || !alert) {
......@@ -61,11 +61,11 @@ Http.prototype.create = function () {
case code_success_value + '':
break
case errId_logout_value + '':
logout()
logout(logout_function)
break
default:
if (errValue && errValue == errId_logout_value) {
logout()
return logout(logout_function)
}
if (alert) {
alert(res.message || res.msg || '出错了,请联系管理员')
......@@ -84,7 +84,11 @@ Http.prototype.create = function () {
this.service.axios = axios
return this.service
}
function logout() {
function logout(logout_function) {
if (window[logout_function]) {
window[logout_function]()
return
}
window.history.pushState(null, '', '/login')
}
export default Http
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!