Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Vue.ls.remove(ACCESS_TOKEN)
window.location.reload()
})
}
})
// update-end- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
}
break
case 404:
notification.error({ message: '系统提示', description:'很抱歉,资源未找到!',duration: 4})
break
case 504:
notification.error({ message: '系统提示', description: '网络超时'})
break
case 401:
notification.error({ message: '系统提示', description:'未授权,请重新登录',duration: 4})
if (token) {
store.dispatch('Logout').then(() => {
setTimeout(() => {
window.location.reload()
}, 1500)
})
}
break
default:
notification.error({
message: '系统提示',
description: data.message,
duration: 4
})
break
}
mask: false,
onOk: () => {
store.dispatch('Logout').then(() => {
Vue.ls.remove(ACCESS_TOKEN)
window.location.reload()
})
}
})
// update-end- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
}
break
case 404:
notification.error({ message: '系统提示', description:'很抱歉,资源未找到!',duration: 4})
break
case 504:
notification.error({ message: '系统提示', description: '网络超时'})
break
case 401:
notification.error({ message: '系统提示', description:'未授权,请重新登录',duration: 4})
if (token) {
store.dispatch('Logout').then(() => {
setTimeout(() => {
window.location.reload()
}, 1500)
})
}
break
default:
notification.error({
message: '系统提示',
description: data.message,
duration: 4
.catch(e => {
console.log(e)
notification.error({
message: e.response.data.message
})
})
}
}).catch(e => {
notification.error({ message: e.reponse.data.message })
})
}
Request.Error = (error) => {
if (error.status === 400 || lodash.get(error, 'request.url', '').indexOf('CheckLogin')) {
return
}
notification.error({
key: 'RequestError' + error.status,
description: error.name,
message: error.message
})
}
/**
.catch(e => {
notification.error({
message: e.response.data.message
})
})
} else {
.catch(e => {
notification.error({
message: e.response.data.message
})
})
} else {
}).catch(e => {
notification.error({ message: e.reponse.data.message })
})
}
}, error => {
if (error.response) {
//带状态码的错误信息
notification.error({
message: '错误',
description: error.response.status + ' - ' + error.response.statusText + ': ' + error.response.data.message,
duration: 3
});
return Promise.reject(error.response);
} else {
//无状态码的错误信息
notification.error({
message: '错误',
description: error.toString(),
duration: 3
});
return Promise.reject(error.response);
}
});
.catch(e => {
notification.error({
message: e.response.data.message
})
})
},