acdlite / acdlite/redux-router

{ push } don`t work in actions

Aperta
#285 1 commento 4 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
2.3k
Fork
194
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## Version
2.1.2
## Steps to reproduce
Add push method to actions
```
export const actions = {};

actions.readStaff = (id) => {
return (dispatch) => {
dispatch(showLoading());
staff.read(id)
.then((response) => {
const data = normalize(response, [staffSchema]);
dispatch(creators.get('readStaff')(data));
})
.then(() => {
dispatch(push('/staff'));
})
.then(() => {
dispatch(hideLoading());
});
};
```
Init action in the component (I also dispatch actions in container for this component)
```
import React, { Component, PropTypes } from 'react';
import { push } from 'redux-router';
import { connect } from 'react-redux';

@connect((state) => ({}))
export default class Menu extends Component {
static propTypes = {
actions: PropTypes.object.isRequired
};

static defaultProps = {
actions: {}
};

constructor (props) {
super(props);
this._toStaff = ::this._toStaff;
}

_toStaff (event) {
event.preventDefault();
this.props.actions.readStaff();
}

render () {
return (

to staff

);
}
}
```
## Expected Behavior
Push to a new page after the response.
If anybody know best solution for this, please contact [me](https://www.facebook.com/mykola.melnichenko).
## Actual Behavior
It dispatch push method with right route in the args, but do nothing.
image 2017-02-18 at 4 07 19 pm

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.