Commit f8a0ed11 by limin

兼容多个codekey

1 parent efefd45f
{
"name": "glsx-common",
"version": "1.4.6",
"version": "1.4.7",
"description": "glsx common",
"main": "./dist/glsx-common.js",
"private": false,
......
......@@ -47,13 +47,14 @@ Http.prototype.create = function () {
this.service.interceptors.response.use(
({ data: res, config: { returnAll } }) => {
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
} = this.customer
if (returnAll || !alert) {
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]
// 特殊的code处理,可以增加
switch (code + '') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!