|
|
@@ -65,32 +65,18 @@ export const createRequest = function(baseURL) {
|
|
|
errorStr = typeof res === 'string' ? res : 'Error'
|
|
|
}
|
|
|
if (code === 401) {
|
|
|
- Message({
|
|
|
- message: errorStr,
|
|
|
- type: 'error',
|
|
|
- duration: 5 * 1000
|
|
|
- })
|
|
|
+ console.log('error', errorStr)
|
|
|
store.dispatch('logout').then(() => {
|
|
|
|
|
|
})
|
|
|
} else {
|
|
|
- Message({
|
|
|
- message: errorStr,
|
|
|
- type: 'error',
|
|
|
- duration: 5 * 1000
|
|
|
- })
|
|
|
+ console.log('error', errorStr)
|
|
|
}
|
|
|
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
|
|
|
if (code === 50008 || code === 50012 || code === 50014 || code === 500) {
|
|
|
// to re-login
|
|
|
- MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', {
|
|
|
- confirmButtonText: 'Re-Login',
|
|
|
- cancelButtonText: 'Cancel',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- store.dispatch('logout').then(() => {
|
|
|
+ store.dispatch('logout').then(() => {
|
|
|
|
|
|
- })
|
|
|
})
|
|
|
}
|
|
|
return Promise.reject(new Error(res.message || 'Error'))
|