We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1a86ae7 + 19190b3 commit ce8b177Copy full SHA for ce8b177
src/app.tsx
@@ -100,6 +100,10 @@ const errorHandler = (error: ResponseError) => {
100
message: `请求错误 ${status}: ${url}`,
101
description: errorText,
102
});
103
+
104
+ if(response.status == 401){ //未登录跳转登录
105
+ history.push('/user/login');
106
+ }
107
}
108
109
if (!response) {
@@ -117,7 +121,9 @@ export const request: RequestConfig = {
117
121
// 请求拦截器
118
122
requestInterceptors: [
119
123
(url: string, options) => {
120
- options.headers = { Authorization: `Bearer ${sessionStorage.getItem('token') ?? ''}` };
124
+ options.headers = {
125
+ Accept: 'application/json',
126
+ Authorization: `Bearer ${sessionStorage.getItem('token') ?? ''}` };
127
return { url, options };
128
129
],
0 commit comments