jamesplease / jamesplease/redux-resource

redux-resource-fetch

Open
#276 1 comment 0 reactions 0 assignees View on GitHub
ecosystem extra
Dominant language
JavaScript
Stars
232
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Assuming #275 isn't closed in favor of #250, I should figure out the API for redux-resource-fetch, making the assumption that AbortController is supported.

The popular GitHub fetch polyfill may soon support this: https://github.com/github/fetch/issues/547

---

One possibility based on #275 :

```js
// There is now only one method!
// The first argument determines which CRUD action it is
crudRequest('read', {
url: '/pasta/pls',

// These are options to configure the XHR request
fetchOptions: {
credentials: 'include',
signal: abortController.signal
},

// These are properties that are merged into the start and end action by default
actionProperties: {
resourceName: 'books',
mergeMeta: false
},

// same as what exists today
transformData(data) {
return body.data;
}
})
.then(
(action, body) => dispatch(action)
(action, err) => dispatch(action)
);
```

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the related proposals in issues #275 and #250, then compare them with the existing redux-resource-fetch API referenced as “what exists today.” Confirm the AbortController and fetchOptions assumptions and define an agreed API; the work is done when the API design is settled and implemented consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.