title: Angular 2 - Waiting for authentication api call to resolve first before making other api requests
body: <p>I would like to make call to <code>api/authenticate</code> endpoint on my server before making any further requests.</p>
  
  <p>I have many components such as Users, Flights, Airports. They all get data from their corresponding api endpoints. (e.g <code>api/users</code>, <code>api/flights</code>, <code>api/airports</code>)</p>
  
  <p>I am making <code>api/authenticate</code> call in ngOnInit() function inside the main component <code>AppComponent</code>.</p>
  
  <p>However the problem is that, ngOnInit() function of the nested component <code>FlightsComponent</code> sends request to <code>api/flights</code> before <code>api/authenticate</code> call resolves in ngOnInit() fucntion of <code>AppComponent</code>.</p>
  
  <p>I would appreciate any ideas on how to organize the code so that <code>api/authenticate</code> request is resolved first before making any further api requests.</p>