Hi, I’m trying to make a POST request of a user object, but this user object has a relation with validation, and for that, I first check if the user has this object validation, if it is true, before I make the user POST request, I make the validation POST request.
When I make the user request, the id field is the same on the two systems, but when I make the validation request, it has a new id, not the original
module.exports = {
lifecycles: {
// Called after an entry is created
async afterCreate(user) {
console.log(user)
if (user.validation != null)
await axios.post('http://192.168.1.8:3000/validated-users/', user.validation)
.catch(error => console.error(error))
user.validation = user.validation.id
axios.post('http://192.168.1.8:3000/users/', user)
.catch(error => console.error(error))
},
async afterUpdate(user) {
if (user.validation)
user.validation = user.validation.id
axios.put('http://192.168.1.8:3000/users/' + user.id, user)
.catch(error => console.error(error))
}
},
};