当他从我的列表页面成功创建对象时,我试图将我的用户重定向到详细信息页面。这是我的代码:
历史.js
import {createHashHistory} from 'history';
const history = createHashHistory();
export default history
应用程序.js
class App extends Component {
render() {
return (
<Router history={history}>
<Alerts/>
<Switch>
<PrivateRoute exact path="/" component={Main}/>
<Route path="/login" component={Login}/>
</Switch>
</Router>
)
}
}
佐贺
export function* workerCreateTicket(action) {
...
...
yield call(forwardTo, `/tickets/${data.data.id}`); //<--- function to redirect if successful
...
}
function forwardTo(location) {
history.push(location);
}
预期的
我希望 URL 是这样的:
http://127.0.0.1:3000/tickets/14
结果 但是我收到了这个
http://127.0.0.1:3000/tickets#/tickets/14