I need to send data to backend, but I am having this error:
Uncaught (in promise) Error: Request failed with status code 404
How can I solve this??
Image below:
Code javascript below:
handleClick(_success, _error) {
const usuarioLogin = this.props.cliente;
const usuarioCliente = parseInt(this.state.usuario);
const ObjetoChamado = {
titulo: this.state.titulo,
descricao: this.state.descricao,
area: parseInt(this.state.area),
categoria: parseInt(this.state.categoria),
servico: parseInt(this.state.servico),
usuario: usuarioLogin,
cliente: usuarioCliente,
};
this.props.abrirChamado(
ObjetoChamado,
(response) => {
this.props.getChamados(usuarioLogin, null, (chamados) => {
// Chamado aberto, atualizar lista e fechar o popup de abertura
this.props.setClientData(usuarioLogin, null, chamados.data.objeto);
this.props.visible(false);
});
},
(error) => {
alert(!!error ? error : 'Não foi possível abrir o chamado.');
}
);
axios.post(ObjetoChamado).then((response) => {
const data = response.data;
// if (Object.keys(data).length > 0) {
// if (typeof _success === 'function') _success(data);
// } else {
// if (typeof _error === 'function') {
// _error({
// code: 404,
// message: 'Não há nenhum registro para este cliente.',
// });
// }
// }
console.log('DATA:', data);
});
};
