{"_id":"redux-wait-for-action","_rev":"10-da21d034b2e5ef8a433c1d7cd7ccbb15","name":"redux-wait-for-action","description":"Redux middleware to make store.dispatch() return a promise and wait for another action","dist-tags":{"latest":"0.0.8"},"versions":{"0.0.1":{"name":"redux-wait-for-action","version":"0.0.1","description":"Redux middleware to make store.dispatch() return a promise and wait for another action","main":"lib/index.js","scripts":{"build":"make build","test":"make test","lint":"make lint"},"author":{"name":"Chion Tang","email":"sdspeedonion@gmail.com"},"license":"MIT","devDependencies":{"babel-cli":"^6.18.0","babel-eslint":"^7.1.1","babel-preset-es2015":"^6.18.0","babel-preset-stage-0":"^6.16.0","eslint":"^3.12.2","mocha":"^3.2.0"},"keywords":["redux","redux-saga","react"],"gitHead":"72c40cf0f4e954ca82b5e9140d84f1f7eedbc8d8","_id":"redux-wait-for-action@0.0.1","_shasum":"b1189458f70e3b8f9db30845061dfabf499b2aaf","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.0","_npmUser":{"name":"chion82","email":"tech@chionlab.moe"},"dist":{"shasum":"b1189458f70e3b8f9db30845061dfabf499b2aaf","tarball":"https://registry.npmjs.org/redux-wait-for-action/-/redux-wait-for-action-0.0.1.tgz","integrity":"sha512-rx/HCry5geNAsjp2qtJh9iOPA+VvAfc1c18YHhTzgJMfDHFpnAcwFQBWGhrOSzf320/wBN3zKe8hvNCa+0W7Xw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC9zP3V/q9A5vFDPQRmWkJtnpe3klsVNMZaRUrVUaeU9AiEAstyHcnirKkzaxijpCm+R2M4n3AxuwxikzK9cOm9cAIM="}]},"maintainers":[{"name":"chion82","email":"tech@chionlab.moe"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/redux-wait-for-action-0.0.1.tgz_1482254328480_0.7506519984453917"},"directories":{}},"0.0.2":{"name":"redux-wait-for-action","version":"0.0.2","description":"Redux middleware to make store.dispatch() return a promise and wait for another action","main":"lib/index.js","scripts":{"build":"make build","test":"make test","lint":"make lint"},"author":{"name":"Chion Tang","email":"sdspeedonion@gmail.com"},"license":"MIT","devDependencies":{"babel-cli":"^6.18.0","babel-eslint":"^7.1.1","babel-preset-es2015":"^6.18.0","babel-preset-stage-0":"^6.16.0","eslint":"^3.12.2","mocha":"^3.2.0"},"repository":{"type":"git","url":"git+https://github.com/Chion82/redux-wait-for-action.git"},"keywords":["redux","redux-saga","react"],"gitHead":"c12e1d64ca3d058f18030d845f86ed5f73a9c46e","bugs":{"url":"https://github.com/Chion82/redux-wait-for-action/issues"},"homepage":"https://github.com/Chion82/redux-wait-for-action#readme","_id":"redux-wait-for-action@0.0.2","_shasum":"bc4fde40b8c5ab0fdbce64b0a7af4778cc4fb954","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.0","_npmUser":{"name":"chion82","email":"tech@chionlab.moe"},"dist":{"shasum":"bc4fde40b8c5ab0fdbce64b0a7af4778cc4fb954","tarball":"https://registry.npmjs.org/redux-wait-for-action/-/redux-wait-for-action-0.0.2.tgz","integrity":"sha512-n0bmYcLKdeBd7hFMFQcHOT32GIOigYH2CUhetxJshitEC8zUYACyxcideBtX529WU+x1WJ+GB+IHAArlC4aj7g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCIbVqdbX1U0QLf9GrUAmLb7KtHJf7w6RmyyFdkgSU7YgIhANGfhIq7OJmN9qV1zva/LqUIFvV6J+Twr8lyOntIp3Iv"}]},"maintainers":[{"name":"chion82","email":"tech@chionlab.moe"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/redux-wait-for-action-0.0.2.tgz_1482255511669_0.37818448850885034"},"directories":{}},"0.0.3":{"name":"redux-wait-for-action","version":"0.0.3","description":"Redux middleware to make store.dispatch() return a promise and wait for another action","main":"lib/index.js","scripts":{"build":"make build","test":"make test","lint":"make lint"},"author":{"name":"Chion Tang","email":"sdspeedonion@gmail.com"},"license":"MIT","devDependencies":{"babel-cli":"^6.18.0","babel-eslint":"^7.1.1","babel-preset-es2015":"^6.18.0","babel-preset-stage-0":"^6.16.0","eslint":"^3.12.2","mocha":"^3.2.0"},"repository":{"type":"git","url":"git+https://github.com/Chion82/redux-wait-for-action.git"},"keywords":["redux","redux-saga","react"],"gitHead":"5572aced4f855437b741a6196fa6da7a5a02247c","bugs":{"url":"https://github.com/Chion82/redux-wait-for-action/issues"},"homepage":"https://github.com/Chion82/redux-wait-for-action#readme","_id":"redux-wait-for-action@0.0.3","_shasum":"2102096ccac892043df8c657745cb64fa95e057d","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.0","_npmUser":{"name":"chion82","email":"tech@chionlab.moe"},"dist":{"shasum":"2102096ccac892043df8c657745cb64fa95e057d","tarball":"https://registry.npmjs.org/redux-wait-for-action/-/redux-wait-for-action-0.0.3.tgz","integrity":"sha512-u2Urwrvt42pN95h9TB+eXOhl5BUH73Y2SisevloiFJgf6r0WynJz8VSksSWJmqp+kHQEhSP5zeWg3idAQxZTWg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA3eQjVHC3AKMNqfo/LEdN1sJFoqeobkeRSzeJuV0l3PAiEAnCYi3LoyCU3AQQ9QBqXq/GL//2vafqIaKR4c54/P4MM="}]},"maintainers":[{"name":"chion82","email":"tech@chionlab.moe"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/redux-wait-for-action-0.0.3.tgz_1482294204489_0.4167633845936507"},"directories":{}},"0.0.4":{"name":"redux-wait-for-action","version":"0.0.4","description":"Redux middleware to make store.dispatch() return a promise and wait for another action","main":"lib/index.js","scripts":{"build":"make build","test":"make test","lint":"make lint"},"author":{"name":"Chion Tang","email":"sdspeedonion@gmail.com"},"license":"MIT","devDependencies":{"babel-cli":"^6.18.0","babel-eslint":"^7.1.1","babel-preset-es2015":"^6.18.0","babel-preset-stage-0":"^6.16.0","eslint":"^3.12.2","mocha":"^3.2.0"},"repository":{"type":"git","url":"git+https://github.com/Chion82/redux-wait-for-action.git"},"keywords":["redux","redux-saga","react"],"gitHead":"0e4f65dfde2eb63d2b63bc31f6a8edfc34d24dd2","bugs":{"url":"https://github.com/Chion82/redux-wait-for-action/issues"},"homepage":"https://github.com/Chion82/redux-wait-for-action#readme","_id":"redux-wait-for-action@0.0.4","_shasum":"685707d0f581fe415616e1ff24b124d5a96f968c","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.0","_npmUser":{"name":"chion82","email":"tech@chionlab.moe"},"dist":{"shasum":"685707d0f581fe415616e1ff24b124d5a96f968c","tarball":"https://registry.npmjs.org/redux-wait-for-action/-/redux-wait-for-action-0.0.4.tgz","integrity":"sha512-mvyEd01dpfhTUKbAEHBOwIhtbrJNC3mxdM2HVKtIut24jVgBxw2+tPQMAou2V921zXHrl/WSU5ZbUa5uDI1uAA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLmcnkCMqGies0pwq8VtHl9c9BaOmW2+9w07x9BxCEDAIga0T3tTmm+sSiBy/WoRkDjGgkVyCJtI5zpOns+RKLe34="}]},"maintainers":[{"name":"chion82","email":"tech@chionlab.moe"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/redux-wait-for-action-0.0.4.tgz_1482319489286_0.9930985583923757"},"directories":{}},"0.0.5":{"name":"redux-wait-for-action","version":"0.0.5","description":"Redux middleware to make store.dispatch() return a promise and wait for another action","main":"lib/index.js","scripts":{"build":"make build","test":"make test","lint":"make lint"},"author":{"name":"Chion Tang","email":"sdspeedonion@gmail.com"},"license":"MIT","devDependencies":{"babel-cli":"^6.18.0","babel-eslint":"^7.1.1","babel-preset-es2015":"^6.18.0","babel-preset-stage-0":"^6.16.0","eslint":"^3.12.2","mocha":"^3.2.0"},"repository":{"type":"git","url":"git+https://github.com/Chion82/redux-wait-for-action.git"},"keywords":["redux","redux-saga","react"],"gitHead":"4f68f22837e4c4aef75156c6d15329a28a9ae978","bugs":{"url":"https://github.com/Chion82/redux-wait-for-action/issues"},"homepage":"https://github.com/Chion82/redux-wait-for-action#readme","_id":"redux-wait-for-action@0.0.5","_shasum":"d68f25e1f904990f7557af24ba10cb81b7be63dd","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.0","_npmUser":{"name":"chion82","email":"tech@chionlab.moe"},"dist":{"shasum":"d68f25e1f904990f7557af24ba10cb81b7be63dd","tarball":"https://registry.npmjs.org/redux-wait-for-action/-/redux-wait-for-action-0.0.5.tgz","integrity":"sha512-7MLRvJg08bx8KZzES2qg1TU5QJCYdxiR9qPH/80eLAD0kMG0YepOix86IhaU5nPruXms6YifHsqvsboDcFrx0Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICxwp9t2Cp6z/dfem8mkdWw+Mo52DKJY3oJOG73FiMOWAiBSYe+qLdy8I4FIe7YbV4VdnmscpQoNGxqrvuaW8zs/vg=="}]},"maintainers":[{"name":"chion82","email":"tech@chionlab.moe"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/redux-wait-for-action-0.0.5.tgz_1482511664557_0.8240139931440353"},"directories":{}},"0.0.6":{"name":"redux-wait-for-action","version":"0.0.6","description":"Redux middleware to make store.dispatch() return a promise and wait for another action","main":"lib/index.js","scripts":{"build":"make build","test":"make test","lint":"make lint"},"author":{"name":"Chion Tang","email":"sdspeedonion@gmail.com"},"license":"MIT","devDependencies":{"babel-cli":"^6.18.0","babel-eslint":"^7.1.1","babel-preset-es2015":"^6.18.0","babel-preset-stage-0":"^6.16.0","eslint":"^3.12.2","mocha":"^3.2.0"},"repository":{"type":"git","url":"git+https://github.com/Chion82/redux-wait-for-action.git"},"keywords":["redux","redux-saga","react"],"gitHead":"1f4d4ec80d294c9e0d4e7a289c92df3c548db71e","bugs":{"url":"https://github.com/Chion82/redux-wait-for-action/issues"},"homepage":"https://github.com/Chion82/redux-wait-for-action#readme","_id":"redux-wait-for-action@0.0.6","_shasum":"dded6680955cead31b51b1eb1178fca985f05289","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.0","_npmUser":{"name":"chion82","email":"tech@chionlab.moe"},"dist":{"shasum":"dded6680955cead31b51b1eb1178fca985f05289","tarball":"https://registry.npmjs.org/redux-wait-for-action/-/redux-wait-for-action-0.0.6.tgz","integrity":"sha512-iPUPy1B4J4lorJm6R4FKmW78Q2CAnN6PSNwxE5W+xLJSuBtxoRREkrVaH1OJnFZVhaXAY/s28QmfVGnF1GfI9w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCyKiXRwso4vLu3tHo5B/VyjZozEyC4ZlmlhO7XzyWcjwIgDfCgtHNaBP5WfPc6i43x2IttO59GcWXBwoV1BT9JCWU="}]},"maintainers":[{"name":"chion82","email":"tech@chionlab.moe"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/redux-wait-for-action-0.0.6.tgz_1483696175405_0.7587128719314933"},"directories":{}},"0.0.7":{"name":"redux-wait-for-action","version":"0.0.7","description":"Redux middleware to make store.dispatch() return a promise and wait for another action","main":"lib/index.js","scripts":{"build":"make build","test":"make test","lint":"make lint"},"author":{"name":"Chion Tang","email":"sdspeedonion@gmail.com"},"license":"MIT","devDependencies":{"babel-cli":"^6.18.0","babel-eslint":"^7.1.1","babel-preset-es2015":"^6.18.0","babel-preset-stage-0":"^6.16.0","eslint":"^3.12.2","mocha":"^3.2.0"},"repository":{"type":"git","url":"git+https://github.com/Chion82/redux-wait-for-action.git"},"keywords":["redux","redux-saga","react"],"gitHead":"5bb1f021ae84c07e44f463b255c3d4b5606c44d2","bugs":{"url":"https://github.com/Chion82/redux-wait-for-action/issues"},"homepage":"https://github.com/Chion82/redux-wait-for-action#readme","_id":"redux-wait-for-action@0.0.7","_shasum":"13ec487fcef089e04463c588eb83996f3f4df36a","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.2","_npmUser":{"name":"chion82","email":"tech@chionlab.moe"},"dist":{"shasum":"13ec487fcef089e04463c588eb83996f3f4df36a","tarball":"https://registry.npmjs.org/redux-wait-for-action/-/redux-wait-for-action-0.0.7.tgz","integrity":"sha512-o8D5EOMujU5zCIpGzE0I1qGOE0GB8wJDCcJYwgX0Idqan+CVmYXhqi76LHxo1gREUph9FUdx5fvztYfwI/hAQA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHWnBXzETM0eV0ZpMbBqPELmael//8rN4P2XEsLNZVOpAiBUK8o8oBPfXKr0xfJTmA8TE5FuWgQQHRiiXXwe3evB0Q=="}]},"maintainers":[{"name":"chion82","email":"tech@chionlab.moe"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-wait-for-action-0.0.7.tgz_1509159472268_0.8339619422331452"},"directories":{}},"0.0.8":{"name":"redux-wait-for-action","version":"0.0.8","description":"Redux middleware to make store.dispatch() return a promise and wait for another action","main":"lib/index.js","scripts":{"build":"make build","test":"make test","lint":"make lint"},"author":{"name":"Chion Tang","email":"sdspeedonion@gmail.com"},"license":"MIT","devDependencies":{"babel-cli":"^6.18.0","babel-eslint":"^7.1.1","babel-preset-es2015":"^6.18.0","babel-preset-stage-0":"^6.16.0","eslint":"^3.12.2","mocha":"^3.2.0"},"repository":{"type":"git","url":"git+https://github.com/Chion82/redux-wait-for-action.git"},"keywords":["redux","redux-saga","react"],"gitHead":"3425d405c853ed17be66bbae209ef06d6e5a06b5","bugs":{"url":"https://github.com/Chion82/redux-wait-for-action/issues"},"homepage":"https://github.com/Chion82/redux-wait-for-action#readme","_id":"redux-wait-for-action@0.0.8","_shasum":"980a648db8293119bfaa1375610319f76c20514f","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.2","_npmUser":{"name":"chion82","email":"tech@chionlab.moe"},"dist":{"shasum":"980a648db8293119bfaa1375610319f76c20514f","tarball":"https://registry.npmjs.org/redux-wait-for-action/-/redux-wait-for-action-0.0.8.tgz","fileCount":10,"unpackedSize":16354,"integrity":"sha512-t1wmfDafSShYmWCcRT9ZImxGqIJz/sibPKWNhfaG5BinZpyULOr0a4zE/uQc1Q7lMYavXg1LAwul8MDSSHi1kA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCTKvRpJII1yJHdwRrcvZQZPMALqJs1zxGnqvnIT2jpiwIhAKwoO6waWDbFGhlRQWSwQV8K+MqmP80hg9J44UlFl5ym"}]},"maintainers":[{"name":"chion82","email":"tech@chionlab.moe"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-wait-for-action_0.0.8_1529068205960_0.20899923794823105"},"_hasShrinkwrap":false}},"readme":"Redux Wait for Action\n--------------------\n[![Build Status](https://travis-ci.org/Chion82/redux-wait-for-action.svg?branch=master)](https://travis-ci.org/Chion82/redux-wait-for-action)\n[![npm version](https://badge.fury.io/js/redux-wait-for-action.svg)](https://badge.fury.io/js/redux-wait-for-action)\n\nRedux middleware to make `store.dispatch()` return a promise which will be fulfilled when another specified action is dispatched, which is useful for universal(isomorphic) React Web Apps with redux and server-side rendering.\n\n```\nnpm install --save redux-wait-for-action\n```\n\nQuick Start\n-----------\n[Minimal starter kit for universal apps with redux and redux-saga](https://github.com/Chion82/react-redux-universal-minimal)\n\nBasic Usage\n-----------\nTo fire `todos/get` action and subscribe for `todos/get/success` action:\n```javascript\nimport { WAIT_FOR_ACTION, ERROR_ACTION } from 'redux-wait-for-action';\nstore.dispatch({\n  type: 'todos/get',\n  [ WAIT_FOR_ACTION ]: 'todos/get/success', // Specify which action we are waiting for\n  [ ERROR_ACTION ]: 'todos/get/failed', // Optional\n}).then( payload => console.log('Todos got!') )\n.catch( error => console.error('Failed!' + error.message) );\n```\nAlternatively, use conditional functions as `WAIT_FOR_ACTION`, which is useful when firing multiple actions with same `action.type` in parallel:\n```javascript\nstore.dispatch({\n  type: 'profile/get',\n  [ WAIT_FOR_ACTION ]: action => action.type === 'profile/get/success' && action.id === 1,\n  // Only subscribe for profile/get/success action whose profile id equals 1\n  [ ERROR_ACTION ]: action => action.type === 'profile/get/failed' && action.id === 1,\n}).then( payload => console.log('ID #1 Profile got!') )\n.catch( error => console.error('Failed!' + error.message) );\n```\n\nFor Isomorphic Apps\n-------------------\n* For each React container, we define a static function `fetchData()` where we return a `store.dispatch()` call followed by automatic execution of side effects. We should call this `store.dispatch()` with an action that also contains information about which action we are waiting for.\n* Use those `fetchData()`s to populate page data on **both client and server side**.\n* On server side, we put the rendering logic in `fetchData().then(() => { /* rendering logic here! */ })`, where side effects are completed and an action with finishing flag is dispatched.\n* If you are using [redux-thunk](https://github.com/gaearon/redux-thunk), `store.dispatch()` already returns a promise and you probably don't need this middleware. However, side effects like [redux-saga](https://github.com/yelouafi/redux-saga) running separately from primitive Redux flow don't explicitly notify us when a specific async fetch is finished, in which case redux-wait-for-action does the trick and makes those async tasks subscribable.\n* Although redux-saga added `runSaga().done` support which returns a promise to tell when a specific saga task is completed, it's quite tricky where saga tasks aren't started by a `dispatch()` call and it does't work when using sagas containing infinite loops.\n\nUsage with react-router and redux-saga\n--------------------------------------\n`configureStore()` function where a Redux store is created on **both client and server side**:\n```javascript\nimport createReduxWaitForMiddleware from 'redux-wait-for-action';\n\nfunction configureStore(initialState) {\n  const sagaMiddleware = createSagaMiddleware();\n  let enhancer = compose(\n    applyMiddleware(sagaMiddleware),\n    applyMiddleware(createReduxWaitForMiddleware()),\n  );\n  const store = createStore(rootReducer, initialState, enhancer);\n\n  // ...\n}\n```\nAssume we have saga effects like this:\n```javascript\nfunction* getTodosSaga() {\n  const payload = yield call(APIService.getTodos);\n  yield put({\n    type: 'todos/get/success',\n    payload\n  });\n}\nfunction* rootSaga() {\n  yield takeLatest('todos/get', getTodosSaga);\n}\n```\nDefine a `fetchData()` for each of our containers:\n```javascript\nimport { WAIT_FOR_ACTION } from 'redux-wait-for-action';\n\nclass TodosContainer extends Component {\n  static fetchData(dispatch) {\n    return dispatch({\n      type: 'todos/get',\n      [ WAIT_FOR_ACTION ]: 'todos/get/success',\n    });\n  }\n  componentDidMount() {\n    // Populate page data on client side\n    TodosContainer.fetchData(this.props.dispatch);\n  }\n  // ...\n}\n```\nHere in our action we specify `WAIT_FOR_ACTION` as `'profile/get/success'`, which tells our promise to wait for another action `'profile/get/success'`. `WAIT_FOR_ACTION` is a ES6 `Symbol` instance rather than a string, so feel free using it and it won't contaminate your action.\n\nNext for server side rendering, we reuse those `fetchData()`s to get the data we need:\n```javascript\n//handler for Express.js\napp.use('*', handleRequest);\nfunction handleRequest(req, res, next) {\n  //...\n  match({history, routes, location: req.url}, (error, redirectLocation, renderProps) => {\n    //...handlers for redirection, error and null renderProps...\n\n    const getReduxPromise = () => {\n      const component = renderProps.components[renderProps.components.length - 1].WrappedComponent;\n      const promise = component.fetchData ?\n        component.fetchData(store.dispatch) :\n        Promise.resolve();\n      return promise;\n    };\n\n    getReduxPromise().then(() => {\n      const initStateString = JSON.stringify(store.getState());\n      const html = ReactDOMServer.renderToString(\n        <Provider store={store}>\n          { <RouterContext {...renderProps}/> }\n        </Provider>\n      );\n      res.status(200).send(renderFullPage(html, initStateString));\n    });\n  });\n}\n```\n\n\nAdvanced Usage\n--------------\n### Error Handling\n\nUse `try-catch` clause in saga effects. The `todos/get/failed` action object should contain a top-level key `error` or `err` whose value is an error descriptor(An `Error()` instance or a string).\n```javascript\nfunction* getTodosSaga() {\n  yield take('todos/get');\n  try {\n    const payload = yield call(APIService.getTodos);\n    yield put({\n      type: 'todos/get/success',\n      payload\n    });\n  } catch (error) {\n    yield put({\n      type: 'todos/get/failed',\n      error\n    });\n  }\n}\n```\nMake sure both `WAIT_FOR_ACTION` and `ERROR_ACTION` symbols are specified in your `todos/get` action:\n```javascript\nimport { WAIT_FOR_ACTION, ERROR_ACTION } from 'redux-wait-for-action';\n\nclass TodosContainer extends Component {\n  static fetchData(dispatch) {\n    return dispatch({\n      type: 'todos/get',\n      [ WAIT_FOR_ACTION ]: 'todos/get/success',\n      [ ERROR_ACTION ]: 'todos/get/failed',\n    });\n  }\n  // ...\n}\n```\nServer side rendering logic:\n```javascript\ngetReduxPromise().then(() => {\n  // ...\n  res.status(200).send(renderFullPage(html, initStateString));\n}).catch((error) => { //action.error is passed to here\n  res.status(500).send(error.message);\n});\n```\n\n### Overriding the Default Promise Arguments\n\nBy default the `payload` or `data` field on the `WAIT_FOR_ACTION` action is provided to the promise when it is resolved, or rejected with the `error` or `err` field.\n\nThere are two additional symbols, `CALLBACK_ARGUMENT` and `CALLBACK_ERROR_ARGUMENT`, which can be used to override this behavior. If functions are stored on the action using these symbols, they will be invoked and passed the entire action. The result returned from either function is used to resolve or reject the promise based on which symbol was used.\n\n```javascript\nimport { WAIT_FOR_ACTION, ERROR_ACTION, CALLBACK_ARGUMENT, CALLBACK_ERROR_ARGUMENT} from 'redux-wait-for-action';\nstore.dispatch({\n  type: 'todos/get',\n  [ WAIT_FOR_ACTION ]: 'todos/get/success',\n  [ ERROR_ACTION ]: 'todos/get/failed',\n  [ CALLBACK_ARGUMENT ]: action => action.customData,\n  [ CALLBACK_ERROR_ARGUMENT ]: action => action.customError,\n}).then( customData => console.log('Custom Data: ', customData) )\n.catch( customError => console.error('Custom Error: ', customError) );\n```","maintainers":[{"name":"chion82","email":"tech@chionlab.moe"}],"time":{"modified":"2022-06-26T10:32:41.453Z","created":"2016-12-20T17:18:48.695Z","0.0.1":"2016-12-20T17:18:48.695Z","0.0.2":"2016-12-20T17:38:31.893Z","0.0.3":"2016-12-21T04:23:26.642Z","0.0.4":"2016-12-21T11:24:49.512Z","0.0.5":"2016-12-23T16:47:46.402Z","0.0.6":"2017-01-06T09:49:35.648Z","0.0.7":"2017-10-28T02:57:52.371Z","0.0.8":"2018-06-15T13:10:06.054Z"},"keywords":["redux","redux-saga","react"],"author":{"name":"Chion Tang","email":"sdspeedonion@gmail.com"},"license":"MIT","readmeFilename":"README.md","homepage":"https://github.com/Chion82/redux-wait-for-action#readme","repository":{"type":"git","url":"git+https://github.com/Chion82/redux-wait-for-action.git"},"bugs":{"url":"https://github.com/Chion82/redux-wait-for-action/issues"}}