ra-data-postgrest
ra-data-postgrest copied to clipboard
The create method should return the data returned by Postgrest and not the posted data
Currently, the create method simply returns what the posted data is (including the id returned by Postgrest). However the Prefer: 'return=representation' is passed in the request which means that Postgrest is going to return the data of the new record. So the create method should simply return the json and not { ...params.data, id: encodeId(json, primaryKey) }
I know the example rest implementation indeed shows returning the posted data, but our dataProvider specifically adds this Prefer: 'return=representation' header, so we know that Postgrest is going to return the data and we should use that for the response.
Thoughts?