- Updated FormActionComponent prop from 'style' to 'bootstrapButtonStyle because 'style' is a built in React prop.
- Linted and added missing propTypes to campaign admin List component.
- Added missing initial state key to campaign reducer.
- Forced REST verb to lowercase in silverstripe-backend to make comparisions more robust.
It's the recommended approach in Redux docs, and more performant (key-based).
It'll also simplify a move to Immutable.js later on.
The PHP APIs still return unkeyed data, which is standard REST API behaviour,
but for Redux state we transform it to be keyed.
You shouldn't have to worry about exactly formatting the reference to
get a ChangeSetItem related to a DataObject, and doing it that way makes
you vulnerable to breakages like introduced in previous API change
Required for REST URLs which require data to be populated on call.
For example, PUT admin/campaigns/set/:id/publish to publish a campaign.
At the time when createEndpointFetcher() is called, the ":id" parameter can not be resolved,
since the "data" argument is passed in once the returned function is evaluated (since the component using it).
Since the whole idea of createEndpointFetcher() is that components shouldn't know about the backend internals,
its not the right place to interpolate urls.
I'm sending through any payload data in addition to replacing URLs, to keep the API simple for the component.
Again, it shouldn't worry about the presence URL interpolation. The trade off here is that data will be submitted
both in the payload (in case of a POST, PUT or DELETE request), as well as (optionally) in the URL.
Tests were previously excluded from eslint calls. This leads to messier
code inside tests, and potentially errors.
Now they all meet the listing rules, and so we don’t need to ignore
tests in .eslintignore.
SilverStripeBackend now has a createEndpointFetcher method, described
in its docblock in more detail.
It’s based the asset-admin code for apiCallerFromEndpoint(). It’s
refactored and generalised into framework in order to provide a
general-purpose API for tying Javascript components to backend APIs.
@todo: tests
FIX: Ensure post has correct content-type header.
Exporting silverstripe-backend lets other modules (such as asset-admin)
use it.
In addition, the Content-type header of a post request of URL-encoded
data was being set to text/plain by default, which isn’t correct and
stopped PHP from interpreting it.