chore: refreshToken
parent
f6d9d1baa8
commit
30f9f11bb7
|
@ -89,22 +89,21 @@ function createRequestClient(baseURL: string) {
|
||||||
return responseData;
|
return responseData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// const { isReturnNativeResponse, isTransformResponse } = config;
|
|
||||||
// // 是否返回原生响应头 比如:需要获取响应头时使用该属性
|
|
||||||
// if (isReturnNativeResponse) {
|
|
||||||
// return response;
|
|
||||||
// }
|
|
||||||
// // 不进行任何处理,直接返回,用于页面代码可能需要直接获取code,data,message这些信息时开启
|
|
||||||
// if (!isTransformResponse) {
|
|
||||||
// return response.data;
|
|
||||||
// }
|
|
||||||
|
|
||||||
const { code, data: result } = responseData;
|
const { code, data: result } = responseData;
|
||||||
if (responseData && Reflect.has(responseData, 'code') && code === 0) {
|
if (responseData && Reflect.has(responseData, 'code') && code === 0) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (code) {
|
||||||
|
case 401: {
|
||||||
|
response.status = 401;
|
||||||
throw Object.assign({}, response, { response });
|
throw Object.assign({}, response, { response });
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
response.status = code;
|
||||||
|
throw Object.assign({}, response, { response });
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,6 @@ export const overridesPreferences = defineOverridesPreferences({
|
||||||
/** 后端路由模式 */
|
/** 后端路由模式 */
|
||||||
accessMode: 'backend',
|
accessMode: 'backend',
|
||||||
name: import.meta.env.VITE_APP_TITLE,
|
name: import.meta.env.VITE_APP_TITLE,
|
||||||
enableRefreshToken: false,
|
enableRefreshToken: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue