Open Swapnilchavan18 opened 7 years ago
seems to be no one willing to help for this repository. I always get Cannot read property 'promise' of undefined
@Swapnilchavan18 Please, RTFM https://github.com/erikras/react-redux-universal-hot-example/blob/master/docs/ApiConfig.md
My problem is that it does not render server side api called data http://stackoverflow.com/questions/40912655/server-side-data-fetching-does-not-work-in-this-example-https-github-com-erikr
I'll try to explain what is trying to be conveyed in easier terms. The apiClient used in this project prepends the request with a baseUrl.
The baseUrl is set in the apiClient.js. By default it's set to a 'http://' + config.apiHost + ':' + config.apiPort;'
when invoked server side, with config values being:
apiHost: process.env.APIHOST || 'localhost',
apiPort: process.env.APIPORT || 3030,
So when you issue your client.get call to http://test.com/api')
it issues a request to http://localhost:3030/http://test.com/api` which obviously will return nothing.
You need to follow TPABHuKOB's link and learn how to remove this prepending of the base url.
Hope that makes sense.
return { types: [LOAD, LOAD_SUCCESS, LOAD_FAIL], promise: (client) => client.get('http://localhost:3030/loadInfo') }; Above part I want to call as getting data from another server api like below. return { types: [LOAD, LOAD_SUCCESS, LOAD_FAIL], promise: (client) => client.get('http://test.com/api') }; How to do this, please explain.