load the api asynchronously

This should solve the api loading problem.  It should work fine switching from any tab, not just refreshing the page on itself.