Error property support #52
sylvanaar posted onGitHub
I have become a little more familiar with the API's, and I really like them, they are super flexible and encourage use of FSA which is great.
I have been able to create an error action using createStandardAction
but it wasn't clear how to do it with the other 2 API's.
The way our action creators were written previously, the meta value was the first parameter - so we would like to continue that, so we are writing them using action
, but looking at action
it isn't clear how to add the error: true
property for an error action. (Actually now we are using createAction
because we want getType
)
Maybe action could be extended to have a 3rd parameter that just let you mix in whatever properties you wanted - or perhaps less flexible but better for FSA's would be to have an error parameter that let you set that property.
fetchDataError: (widgetKey: string, error: Error) =>
createStandardAction(FETCH_DATA_FAILURE).map((payload: Error, meta: string) => ({
payload,
meta: { widgetKey: meta },
error: true as true
}))(error, widgetKey)
Using the API in this way though breaks getType
I haven't tried the Async API's yet though. They might be useful here, but i still need the parameter ordering.