added helpers for making api calls #258
Merged
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.
We were using http helper from react-invenio-forms, to make API calls (https://github.com/inveniosoftware/react-invenio-forms/blob/f6ac055fc704c744561687c8a2f77925abd0ecd4/src/lib/api/connector.js#L22)
Currently, (v4 of react-invenio-forms), it is calling to VND api, but we are still on v3 in which it used to call to application-json.
Unfortunately, due to various reasons, we have inconsistencies on our end as well (some apis dont work, or don't work fully with vnd accept header), so therefore (currently specifically in oarepo-requests, but probably elsewhere as well), we sometimes need to call to application/json and sometimes to vnd. So I thought for safety to simply create two helpers and put them in our code, so we don't get a situation where dependencies upgrade and we end up with broken code. Of course, if we ever manage to get to a point where we can just use vnd header everywhere, we could just delete these and go back to react-invenio-forms helper (which generally I feel is a convenient little abstraction).