reactjs - url replaced but component not loading in react redux -
i redirecting application notfound url action if ajax return 401 dispatch(routeractions.push(constant.prefix+'notfound/')); url updated /notfound component not loading have refresh load notfound component.
here routes.js file code
<provider store={store}> <router history={history}> <route path="/admin" component={appbase} onenter={requireauth} > <indexroute component={userslist} /> <route path="users" component={userslist}/> <route path="product" component={productslist}/> </route> <route path="/admin" component={basepage}> <route path="login" component={login}/> <route path="notfound" component={notfound}/> </route> <route path="*" component={notfound}/> </router> </provider>,
all routes working fine expect redirect /notfound action using
dispatch(routeractions.push('/admin/notfound/'));
here action
import axios 'axios'; import { routeractions,push } 'react-router-redux'; export function fetchdata() { return function(dispatch) { dispatch(requestdata()); return axios.get(user_list_url) .then(function(res){ dispatch(receivedata(res.data)); }) .catch(function(res){ dispatch(receiveerror(res.data)); dispatch(push('/admin/notfound')); }); } };
Comments
Post a Comment