Skip to content

Commit 7928ef0

Browse files
committed
Fixed 401
1 parent df53ece commit 7928ef0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/utils/request.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,14 @@ export default async function request(url, options) {
7373
}
7474

7575
if (status === 401) {
76-
/* eslint-disable no-underscore-dangle */
77-
window.g_app._store.dispatch({ type: 'login/logout' });
78-
return {};
76+
const {
77+
error: { code },
78+
} = data;
79+
if (code === 9999) {
80+
/* eslint-disable no-underscore-dangle */
81+
window.g_app._store.dispatch({ type: 'login/logout' });
82+
return {};
83+
}
7984
}
8085

8186
const error = {
@@ -96,7 +101,8 @@ export default async function request(url, options) {
96101

97102
if (showNotify) {
98103
notification.error({
99-
message: error.message,
104+
message: `${opts.baseURL}${opts.url}`,
105+
description: error.message,
100106
});
101107
}
102108

0 commit comments

Comments
 (0)