0
I have a small JSON called "users"
[
{
"id": 1,
"name": "Arthur",
"data": "1998-11-22",
"email": "[email protected]",
"departamento": "Vendas"
}
]
And another JSON called "departments"
[
{
"id": 1,
"departamento": "Vendas",
"descricao": "O vendedor funciona como uma ligação da organização com o seu cliente."
}
]
When I add a new user has a <select>
showing all departments, I pull these departments directly from JSON, Below is my Change Function
update(form){
return axios.put('http://localhost:3000/departamentos/' + form.id , {
departamento: this.form.departamento,
descricao: this.form.descricao
}).then(res => {
this.load()
this.form.id = ''
this.form.departamento = ''
this.form.descricao = ''
this.updateSubmit = false
alert("Departamento alterado");
}).catch((err) => {
console.log(err);
})
}
I can change the "department" of JSON "departments" normally. The problem is in JSON "users". users.department, it is not updated. Briefly, I add a user with Sales department, change the department name to HR and the user department continues Sales Can someone help me?
Consigo alterar o departamento normalmente e aparece certinho no JSON, o problema é no usuario, o departamento não é atualizado no JSON!
I don’t understand.– Maury Developer
I can change the "department" of JSON "departments" normally. The problem is in JSON "users". users.department, it is not updated.
– Arthur
I have 2 JSON’s, "departments" and "users" When I change "departments.department" is not changed in "users.department" ...
– Arthur
Briefly, I add a user with Sales department, change the department name to HR and the user department continues Sales
– Arthur