I have a service that returns me a user-type object with the id of a user:
My object:
export class Usuario{
email: string;
password: string;
}
In my component I instantiate my object so that it can receive the return of the service:
usuario: Usuario = new Usuario();
And then my service makes the request by returning the object with the id I need:
this.authService.fazerLogin(email,password)
.subscribe(
(data) => {
this.usuario = data;
)}
If I do a console.log (user), I get the id I need, however I'd like to save the return in a string variable instead of an object so that I can save this value in a localstorage to make requests ...
How do I extract this value into a variable?