5
I’m doing a user management. At the moment, I’m creating the put to edit. But, I don’t know how to bring the id on the route.
There is a list of users and also an insert. When the client clicks on the button to recover the password, I would like it to already bring the user id and so put.
This is the update (user.id is coming Undefined because the route is not bringing):
update(user: User) {
this.endpoint = '/users/' + user.id;
return this.service.put(this.endpoint, user);
}
And so the put:
put(path: String, params) {
return this.http.put(this.url + path, params, this.standardHeaders()).map((response: Response) => {
return response.text().length > 0 ? response.json() : {};
});
}