有一个if条件
结果console.log他们什么也没打印,并出现在浏览器控制台 TypeError: Cannot read property 'to' of undefined 上
instance.interceptors.response.use(
(res) => {
const { pathname } = window.location;
const isRedirect = res.status === HTTP_TEMPORARY_REDIRECT;
const data = { isRedirect, data: res.data };
if (isRedirect) {
console.log(`pathname: ${pathname}`);
console.log(`isRedirect: ${isRedirect}`);
const { redirectDataSource: { to: redirectRoute, ...redirectData } }
const {
redirectDataSource: { to: redirectRoute, ...redirectData },
} = res.data.error || res.data;
console.log(`redirectRoute: ${redirectRoute}`);
console.log(`redirectDataSource: ${redirectDataSource}`);
}
return Promise.resolve(data);
},
...
POPMUISE
相关分类