Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Forms
With
formApiAdapter
, you can wrap a redux-api-middleware actioncreator in such a way that it will work as expected by redux-form. The
promise returned by the adapter will:
If the failing payload is a 422 error, the rejection contains error
information in the format expected by redux-form.
The error formatting is Rails-specific for now. It would be possible
to pass the error formatter into
formApiAdapter
and rename ourcurrent formatter as
railsErrorFormatter
or something like that.API calls
Provide a
callApi
helper that wraps a redux-api-middleware action andaugments it as follows:
onSuccess
callback on a successful call. This allows forfollow-up actions to be taken and/or dispatched when the API call
succeeds.
GET
. This can still be overridden.Content-Type: ‘application/json’
header to the request.’true’
and’false’
strings in success payloads to booleansOther
Import specHelper in every spec file (for now).
There’s an issue with mocha-webpack where requiring the spec helper in the config file doesn’t make its changes visible to the actual specs. See zinserjan/mocha-webpack#1.
I forgot to
git pair
on this; I paired with @awc737. This PR supercedes the earlier #34 that @julianrogmans worked on because the project code that this was based on changed significantly since he opened that PR.