I have auth.service.ts with HttpClient variable loaded from constructor with method for calling my api to get information about user and his privileges and if he has still valid token. I calling this method in constructor of my app.component.ts. Its working fine. But, in same page typescript files, I calling api to get initial data for that page. In that pages I have variable of HttpClient defined from constructor.
- problem: And because if that, sometimes I get response from second request soon then from first.
- problem: If I am not wrong, every HttpClient reference define in constructor for every page has same reference. Because If I call two request in same time, on of the response is every time empty.
Any idea how to resolve this? Thank you.