0
With a problem when editing, when I click on the button it looks for the information of the fields in the console.log, already has the ID on the route also the problem is that it does not update the information in the database, follows code:
exports.edit = function (req, res){
var editaRegiao = req.body;
var municipiosarray = [];
for(var i = 0; i < editaRegiao.municipio.length; i++){
municipiosarray.push(editaRegiao.municipio[i].id);
}
municipiosarray.toString()
console.log(req.body);
client.query('update cnes.regiao set descricao = ' + editaRegiao.descricao + ', municipio = ' + editaRegiao.municipio + 'where codigoregiao = ' + req.params.id, (err, result) => {
if (err) return res.json(err);
console.log(err);
console.log(result);
return res.json(result.rows);
})
};
solved, it was just that, thank you!!
– Bruno Elias de Souza
Do not forget to give a + in response and mark as the best for kindness.
– pedro.olimpio