Wait for API Response in Meteor Startup


#1

Hey, I try to create an API calls to remote server in Meteor.startup on client and need to wait for response from them.
So I use redux with redux-thunk and every API call return a Promise, don’t understand how to wait for response in sync way. Maybe somone had same problem and know the solution ? Thanks.

Part of code

Meteor.startup(() => {
  const accessToken = getCookie('access_token');
  Store.dispatch(userActions.checkToken(accessToken)) 
  .then(response => {.... 
  .....

  ...must wait for all dispatch and after render dom elements
 });

#2

Hi,

Have a look at this - covers calling an API, and sticking the outcome into a promise which behaves reactively (i think).

tat