I have mock data to which I want to add values. In particular there is a users object and each user has a rating property which is an array of numbers from 1 to 5. I would like to add further values to this array. I tried it like this:
this.http.post(`api/users?id=${userId}/rating`, rate, this.cudOptions)
but no value is added to the array.
This is the users object:
export var users = [
{
"id": 0,
"firstName": "Stanford",
"lastName": "Reilly",
"username": "StanfRei",
"password": "StanfRei",
"email": "[email protected]",
"cars": [...],
"recentCars": [...],
"observedCars": [...],
"rating": [
3,
5,
3,
2,
1,
3,
5,
5,
5,
2,
5,
1
]
},
{...}
]
I have no problem recovering data with get.
I have no errors.
I have not found anything that helps neither in the official documentation nor on the internet.
How do you post to insert a new value in the rating array of the user?
Thanks