function mapDispatchToProps(dispatch) { return { dispatchPush: (params) => { return dispatch(push(params))}, dispatchScrape: (params) => { return dispatch(getScrapes(params))} }; }
export function * editUser (action) { try { const user = yield call(request.put, `${BASE_URL}/customers/${action.values.id}`, omit(action.values, ['type'])) yield put(usersActions.editUserSuccess(user.data)) yield put(push('/')) } catch (error) { yield put(usersActions.editUserFailed(error)) } }
$http.interceptors.response.use(response => response, error => { const {router} = store.getState() if (error.response.status === 401 && authPathRegExp.test(router.location.pathname)) { store.dispatch(Actions.setAuth({isAuth: false, access_token: null})) store.dispatch(push('/auth/login')) store.dispatch(Actions.addMessage(`[${router.location.pathname}] Login again`)) } return Promise.reject(error) })
render() { return <div> {this.props.route.childRoutes.map(route => <ScrollElement key={route.path} name={route.path}> {React.createElement(route.component, {activate: () => { this.props.dispatch(push(`/${this.props.route.path}/${route.path}`)); }})} </ScrollElement>)} </div>; }
componentWillMount() { let { dispatch, apiEngine } = this.props; userAPI(apiEngine) .logout() .catch((err) => { alert('Logout user fail'); throw err; }) .then((json) => dispatch(logoutUser())) .then(() => dispatch(push('/'))); }
const mapDispatchToProps = dispatch => bindActionCreators( { increment, incrementAsync, decrement, decrementAsync, changePage: () => push('/about-us') }, dispatch )
function mapDispatchToProps(dispatch) { return { onSubmitRegister: (fields) => { dispatch({ type: REGISTER_PROCESS, fields: fields, callback: () => dispatch(push('/login')), }); }, }; }
_handleCancleClick() { let { onCancel, dispatch } = this.props; if (onCancel) { onCancel(); } else { dispatch(push('/')); } }
export function login(payload) { return function loginThunk(dispatch) { dispatch(loginRequest()); return authService.login(payload).then( response => { dispatch(loginSuccess(response)); dispatch(push("/")); }, error => dispatch(loginFailed(error)) ); }; }
const mapDispatchToProps = (dispatch) => { return { updateUserRequest: (values) => { dispatch(usersActions.editUserRequest(values)) }, goTo: (location) => { dispatch(push(location)) } } }
const mapDispatchToProps = dispatch => bindActionCreators( { changePage: () => push('/about-us') }, dispatch )
const mapDispatchToProps = dispatch => bindActionCreators( { changePage: () => push('/about-us') }, dispatch )
export function logout () { return (dispatch, getState) => { dispatch({ type: LOGOUT }) dispatch(push('/')) } }
const mapDispatchToProps = dispatch => bindActionCreators( { increment, incrementAsync, decrement, decrementAsync, changePage: () => push('/about') }, dispatch )