chore: 悦码渲染器不拦截请求的响应
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { useUserStore } from '@/store';
|
||||
import axios from 'axios';
|
||||
|
||||
const apiBase = import.meta.env.VITE_BASE_API_URL;
|
||||
@@ -12,8 +11,6 @@ const instance = axios.create({
|
||||
instance.interceptors.request.use(
|
||||
(config) => {
|
||||
// 可在此处添加统一请求头等配置
|
||||
const userStore = useUserStore();
|
||||
config.headers.Authorization = `Bearer ${userStore.token}`;
|
||||
return config;
|
||||
},
|
||||
(error) => {
|
||||
|
||||
@@ -62,6 +62,11 @@ onMounted(async () => {
|
||||
widgetManager.set('About', {
|
||||
invisible: true
|
||||
});
|
||||
|
||||
widgetManager.set('History', {
|
||||
// 有 bug,先隐藏
|
||||
invisible: true
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -72,6 +72,7 @@ const getParamsFromUrl = (): Partial<InitParams> => {
|
||||
const getInitParams = (): InitParams | null => {
|
||||
if (isWujieSubApp && window.$wujie?.props) {
|
||||
const props: WujieProps = window.$wujie.props;
|
||||
console.log('WujieProps', props);
|
||||
if (props.fileId && props.projectId) {
|
||||
console.log('使用无界初始化渲染器');
|
||||
return props as WujieProps;
|
||||
@@ -113,17 +114,17 @@ const initRequestConfig = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const mergeResponseInterceptors = () => {
|
||||
const responseHandlers = props.interceptors?.response?.handlers || [];
|
||||
responseHandlers.forEach((handler) => {
|
||||
if (isFn(handler?.fulfilled)) {
|
||||
request.useResponse(handler.fulfilled, handler.rejected);
|
||||
}
|
||||
});
|
||||
};
|
||||
// const mergeResponseInterceptors = () => {
|
||||
// const responseHandlers = props.interceptors?.response?.handlers || [];
|
||||
// responseHandlers.forEach((handler) => {
|
||||
// if (isFn(handler?.fulfilled)) {
|
||||
// request.useResponse(handler.fulfilled, handler.rejected);
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
|
||||
mergeRequestInterceptors();
|
||||
mergeResponseInterceptors();
|
||||
// mergeResponseInterceptors();
|
||||
};
|
||||
|
||||
// 显示加载中
|
||||
|
||||
Reference in New Issue
Block a user