Skip to content

Instantly share code, notes, and snippets.

@lcssanches
Last active April 24, 2018 14:28
Show Gist options
  • Save lcssanches/6929d4c3ef9ad6c22584f22c1378c8bd to your computer and use it in GitHub Desktop.
Save lcssanches/6929d4c3ef9ad6c22584f22c1378c8bd to your computer and use it in GitHub Desktop.
/* ... */
updateMobile(mobile){
return function (dispatch) {
return axios.post('/update-mobile',{mobile})
.then(response=>{
dispatch(success());
})
.catch(e=>{
dispatch(error())
});
}
}
cena.js
/* ... */
function onPressButton(){
this.props.updateMobile(mobile).then(()=>{
if(this.props.success){
this.props.navigation.navigate('proximo');
}
});
}
/* ... */
//mapDispatchToProps (success), mapStateToProps (updateMobile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment