Open SafaAlfulaij opened 2 years ago
We should probably reverse the order of these settings, so that custom settings can always be used to override defaults. For example:
const settings = {
method: 'PATCH',
json: requestDoc,
...requestProcessor.buildFetchSettings(request)
};
Of course, we'll need some tests to ensure that this doesn't have unintended side effects.
Exactly. I'm not sure though why it was not like that when you wrote it :)
https://github.com/orbitjs/orbit/blob/a3e44597a43e58e1d788e473a9a24edd6bf747e0/packages/%40orbit/jsonapi/src/lib/transform-requests.ts#L160-L164
I have several cases that I need to call custom endpoints to act on records. These endpoints doesn't comply fully with JSON:API, but I'd like Orbit to call them since they return proper formatted JSON:API responses that I would like Orbit to process (add to cache, etc).
Currently:
Example:
(Just an example,
purify-air
can change a lot of other things based on different planet conditions, so can't simply sayreplaceAttribute(..., "oxygen", 1)
) Return:Note that I'm using
POST
instead ofPATCH
for this custom endpoint, and would like Orbit to treat it asupdateRecord/PATCH