Bloomca / redux-tiles

Composable way to create less verbose Redux code
https://redux-tiles.js.org/
MIT License
236 stars 10 forks source link

Add `data` and `error` fields to dispatched values #22

Closed Bloomca closed 7 years ago

Bloomca commented 7 years ago

Right now we don't return anything from the dispatch function, and as I understand, unless we return special type of object, no middleware will change it.

So, the idea is to actually return values, and not only internal values (like payload), but also the same interface as in selectors, so it will allow to avoid cumbersome constructions like in the README.md:

// login user
await dispatch(actions.tiles.user.authRequest(params));

// check the result
const { data: { id }, error } = selectors.tiles.user.authRequest(getState());

We can just write more elegantly:

const { data: { id }, error } = await dispatch(actions.tiles.user.authRequest(params));
Bloomca commented 7 years ago

Done with #23