You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@redux-requests/promise

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@redux-requests/promise - npm Package Compare versions

Comparing version

to
0.1.4

8

package.json
{
"name": "@redux-requests/promise",
"version": "0.1.3",
"description": "Promise driver for Redux-Requests, Redux addon to simplify AJAX requests",
"version": "0.1.4",
"description": "Promise driver for redux-requests, declarative AJAX requests and automatic network state management for Redux",
"main": "lib/index.js",

@@ -19,3 +19,3 @@ "module": "es/index.js",

],
"homepage": "https://github.com/klis87/redux-requests",
"homepage": "https://redux-requests.klisiczynski.com",
"bugs": {

@@ -64,3 +64,3 @@ "url": "https://github.com/klis87/redux-requests/issues"

},
"gitHead": "a217d990a46f75c5bdc91e09abcac3928aeed132"
"gitHead": "de8bfae3a513920b1327287e7685630d4015be2e"
}

@@ -9,3 +9,3 @@ # @redux-requests/promise

Promise driver to Redux - addon to simplify handling of AJAX requests.
Promise driver for redux-requests, declarative AJAX requests and automatic network state management for Redux

@@ -19,3 +19,3 @@ ## Installation

```
```
or you can just use CDN: `https://unpkg.com/@redux-requests/promise`.

@@ -25,40 +25,6 @@

This driver is useful when you work directly with promises.
For usage, see [redux-requests docs](https://redux-requests.klisiczynski.com).
For instance, you could do something like that:
```js
import { createDriver } from '@redux-requests/promise';
handleRequests({
driver: createDriver({
AbortController: window.AbortController,
processResponse: response => ({ data: response }),
}),
});
const fetchPhoto = id => ({
type: FETCH_PHOTO,
request: {
promise: axios.get(`https://jsonplaceholder.typicode.com/photos/${id}`),
},
});
```
`AbortController` is optional, by default it will use `AbortController` if available,
with fallback to `DummyAbortController` which does nothing. If your environment doesn't
support `AbortController`, you could pass a [polyfill](https://github.com/mo/abortcontroller-polyfill).
If you don't, requests abort won't work.
`processResponse` is also optional, the default is `response => ({ data: response })`,
it is useful if your promises resolve to more things than `data`, then you could for instance use
`response => ({ data: response.data })`
For usage, see [redux-requests docs](https://github.com/klis87/redux-requests).
Also note, that for mutations you need to pass `meta.asMutation: true` in your request actions,
so the core library could know whether a request is a query or a mutation.
## Licence
MIT