title: React Router v4 login check after hitting Refresh on browser
body: <p>I'm using react router v4 and trying to implement a protected api view. E.g., if a user goes to <code>/add/</code> url while not logged in, they would be redirected to <code>/login/</code>, then upon successful login taken to <code>/add/</code>.</p>
  
  <p>I was able to implement it using the idea <a href="https://stackoverflow.com/a/44150979/6896301">from this post</a>. However, I run into issues whenever the initial http request that loads the app is from a protected url. </p>
  
  <p>E.g. when I enter in the browser <code>'/add/'</code> and hit enter, I run into async issues where my app doesn't have time to make an ajax request to the server to check for login, and as a result the router ends up routing to the <code>/login/</code> because ajax auth request hasn't completed.</p>
  
  <p>Can someone recommend login workflow should be handled generally, taking into account the fact that a user may start their session on a protected url like <code>'/add/'</code> and not on the home <code>'/'</code>?</p>