我有一个 React App 作为 Wordpress 存储库中的子模块。React App 负责库存及其所有页面,而 Wordpress 负责所有其他页面。
我有一个获取库存详细信息的传奇功能。如果没有响应,我想将其重定向到另一个页面。yield put(push('/sales'). 问题是这个页面存在于 Wordpress 上,而不是我的 React 应用程序上。因此,当执行此操作时,它会尝试在 react 中查找路由,但没有找到,然后转到 404 页面。但是,当我刷新时,它会加载 Wordpress 页面。我尝试在里面添加一个绝对 URL yield put(push(URL)),但它发送给我一个无限重定向循环。我想知道是否可以仅重定向到 redux 传奇中的 Wordpress 页面。
function* requestInventoryDetails(action) {
try {
if (response && response.stockNumber) {
.
.
.
} else {
yield put(push('/sales'))
// window.location.reload()
}
} catch (err) {
yield put(SET_ERROR('There was an error retrieving the inventory details'))
throw err
}
}