I'm getting user data from my API with Angular 2 using the following method:
getUserData()
{
if (this.getToken()) {
console.log("Getting user..");
this.http.get('thisUser?token='+this.getToken())
.map((res:Response) => res.json())
.subscribe(
data => {
this.userData = data.user;
},
err => { this.checkToken(err); }
);
}
Now, Assuming every user has points
- An API call has been made, my angular 2 app retrived that the user points value is 10.
- the user
"points"
(database column) value has raised from 10 points to 15. - Once I got the data from my API call, the user see his number of points is 10.
- The app don't have a way to know if the points have changed in the database, and my angular 2 app shows that the current user has 10 points while his number of points already updated to 15, somewhere.
Any way to update this information, live?