erikras / erikras/react-redux-universal-hot-example
Issues with API Proxy
- Dominant language
- JavaScript
- Stars
- 12.1k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
I think the proxying is fine and it separates the api from the "front-end" nicely.
I am having a little bit more trouble finding a good reason why ApiClient is making a request to the proxy server. This seems overkill and complicate things. Unfortunately I don't have a better solution.
I am running into this issue: after passport login, during the redirect, it tries to make the loadAuth request while the cookie is not set yet. (Why the store I am using is answering and passport adds the user to req before the session is actually is a mystery I tried to solve to no avail) The result is that this call does not have the cookie and it looks like I am not logged in. Only after a page refresh it looks like I am logged in.
My workaround for the moment is to add a ssr=false query param when the user logs in. And do the following in server.js. This way, the client is doing the authLoad
```
if (__DISABLE_SSR__ || req.query.ssr === 'false') {
hydrateOnClient();
return;
}
```
I want to find a better solution when I get the time
Any suggestions?
Contributor guide
Assessment
This issue has not been assessed yet.