react-router#hashHistory JavaScript Examples
The following examples show how to use
react-router#hashHistory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: common.js From doraemon with GNU General Public License v3.0 | 6 votes |
_fetchLoginByTicket = async ticket => new Promise((resolve) => {
loginByTicket({ ticket }, (response) => {
resolve(response.data)
}, (response) => {
const obj = parseQueryString(window.location.href)
console.log(obj)
if (obj.ticket || obj.mode) {
message.info('登录过期或服务不可用')
} else {
hashHistory.replace('/login')
}
})
})
Example #2
Source File: common.js From doraemon with GNU General Public License v3.0 | 6 votes |
_fetchNav = pathname => new Promise((resolve) => {
// try {
// if (JSON.parse(sessionStorage.getItem('menu')).length > 0) {
// resolve()
// return
// }
// } catch (e) { e }
nav({}, (response) => {
const { list } = response.data
if (list.length === 0) {
message.info('该账户没有任何菜单权限,请联系管理员')
hashHistory.replace('/login')
// this.setState({ loading: false })
return
}
sessionStorage.setItem('menu', JSON.stringify(list))
// TODO:添加完菜单权限后,需要增加以下代码
// if (pathname !== '/' && !isHasCurrentMenu(list, pathname)) {
// if (process.env.NODE_ENV === 'production') {
// hashHistory.replace('/')
// }
// }
resolve()
})
})
Example #3
Source File: fetchOrderActions.js From mesh-demo with Apache License 2.0 | 6 votes |
export function fetchOrderInfo(cartInfo,uid,cartService){
return function(dispatch){
dispatch(requestOrderInfo(cartInfo));
dispatch(loadingShow())
return getOrderInfo(cartInfo).then(res=>{
dispatch(receiveOrderInfo(res.data));
dispatch(loadingHide());
dispatch(cartHidden(cartService))
res.data.Success && dispatch(clearCartInfo(uid));
hashHistory.push('/checkout');
},error=>{
dispatch(receiveErrorInfo(error));
dispatch(loadingHide())
})
}
}
Example #4
Source File: history.js From doraemon with GNU General Public License v3.0 | 5 votes |
history = process.env.NODE_ENV === 'production' ? browserHistory : hashHistory
Example #5
Source File: App.js From mesh-demo with Apache License 2.0 | 5 votes |
routes = ( <Router history={hashHistory}> <Route path='/productList' component={Product} /> <Route path='/checkout' component={CheckOut} /> <Redirect from = '/' to = '/productList' /> <Redirect from = '/*' to = '/' /> </Router> )
Example #6
Source File: navigate.js From mesh-demo with Apache License 2.0 | 5 votes |
navigate(){
hashHistory.push('/productList')
}
Example #7
Source File: Root.js From react-stack-grid with MIT License | 5 votes |
Root = ({ routes }) => (
<Router history={hashHistory}>
{routes()}
</Router>
)