1
Hello,
For some reason I make a call and I get the desired return, but it gives an error of Dispatch
, I’ve tried several things and nothing works.
My action:
export const formulariosExternos = dispatch => {
return axios({
method: "GET",
url: `${API_CONTEUDO_EXTERNO}/conteudo/formularios-externos`,
headers: {
"content-type": "application/json"
}
}).then(response => {
console.log("resposta do get", response.data);
dispatch({
type: FORMULARIOS_EXTERNOS,
payload: response.data
});
});
};
Reduce:
case FORMULARIOS_EXTERNOS:
console.log("reducer", action.payload)
return {
...state,
formulariosExternos: action.payload
};
And exported in the component thus:
export default connect(mapStateToProps, {
submitLogin,
closeModalAvisoBloqueado, formulariosExternos
})(withRouter(LoginForm));
I’m calling in a component thus:
{console.log(this.props.formulariosExternos())}
Tries with
this.props.dispatch
I think that might be it– Maycon F. Castro
@Mayconf.Castro at what point this?
– Matheus Ribeiro
Barter
dispatch({
 type: FORMULARIOS_EXTERNOS,
 payload: response.data
 });
– Maycon F. Castro
error the same way, I have other endpoints using this Dispatch, even don’t find this.props in the action
– Matheus Ribeiro
Ta using mapDispatchToProps? in connect, instead of using mapStateToProps, use null
– Emerson Vieira