I have a Button
with a onPress
If I put this onPress
like this:
onPress={() => request.manifestacaoAnonima(
this.state.email,
this.state.selected,
this.state.manifesto,
this.state.tipomanifestacao,
this.state.tipopessoa,
this.state.latitude,
this.state.longitude,
this.state.endereco,
this.state.numero,
this.state.complemento,
this.state.bairro,
this.state.cidade
)}
It works send the data to API , everything ok.
But if I try to call another function in this same onPress
:
onPress={() => { request.manifestacaoAnonima(
this.state.email,
this.state.selected,
this.state.manifesto,
this.state.tipomanifestacao,
this.state.tipopessoa,
this.state.latitude,
this.state.longitude,
this.state.endereco,
this.state.numero,
this.state.complemento,
this.state.bairro,
this.state.cidade
), Actions.index() }
}
It runs Actions.index()
correctly but returns Request failed with status code 500
on request
What could be the reason?
EDIT
The request
you are calling comes from import request from './services/request';
Which has:
const request = {
let: dssenha = geraSenha(6),
manifestacaoAnonima: (
eeemailusuario,
local,
dstextomanifestacao,
idtipomanifestacao,
tipopessoa,
latitude,
longitude,
endereco,
numero,
complemento,
bairro,
cidade
) => {
axios.post('http://192.168.0.23/apiTeste/public/api/manifestacao?'
+'dssenha='+dssenha
+'&dstextomanifestacao='+dstextomanifestacao
+'&eeemailusuario='+eeemailusuario
+'&nmpessoa=Anônimo'
+'&nrpronac='+local
+'&tipopessoa='+tipopessoa
+'&idtipomanifestacao='+idtipomanifestacao
+'&latitude='+latitude
+'&longitude='+longitude
+'&enendereco='+endereco
+'&nrendereco='+numero
+'&dscomplemento='+complemento
+'&dsbairro='+bairro
+'&dslocalidade='+cidade
)
.then(response => {
console.log(response);
}).catch((error) => {
console.log(error.message)
});
},
};
export default request;