ackee-http-client
Advanced tools
Comparing version 1.1.2 to 2.0.0
@@ -8,2 +8,3 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
import * as Store from './store'; | ||
import saga from './sagas'; | ||
@@ -87,4 +88,5 @@ var authRequestProxy = function authRequestProxy(methodHandler) { | ||
api: api, | ||
authApi: authApi | ||
authApi: authApi, | ||
saga: saga | ||
}; | ||
} |
export { default as create } from './create'; | ||
export { default as saga } from './sagas'; | ||
import * as _sagaEffects from './saga-effects'; | ||
export { _sagaEffects as sagaEffects }; |
@@ -26,2 +26,4 @@ "use strict"; | ||
var _sagas = _interopRequireDefault(require("./sagas")); | ||
var authRequestProxy = function authRequestProxy(methodHandler) { | ||
@@ -105,4 +107,5 @@ return ( | ||
api: api, | ||
authApi: authApi | ||
authApi: authApi, | ||
saga: _sagas.default | ||
}; | ||
} |
@@ -16,8 +16,2 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "saga", { | ||
enumerable: true, | ||
get: function get() { | ||
return _sagas.default; | ||
} | ||
}); | ||
exports.sagaEffects = void 0; | ||
@@ -27,6 +21,4 @@ | ||
var _sagas = _interopRequireDefault(require("./sagas")); | ||
var _sagaEffects = _interopRequireWildcard(require("./saga-effects")); | ||
exports.sagaEffects = _sagaEffects; |
{ | ||
"name": "ackee-http-client", | ||
"version": "1.1.2", | ||
"version": "2.0.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -11,3 +11,2 @@ # ackee-http-client | ||
- [create](#api-create) | ||
- [saga](#api-saga) | ||
- [Saga Effects](#api-saga-effects) | ||
@@ -37,3 +36,3 @@ | ||
By creating new instance of `HttpClient`, you will get `api` and `authApi` objects. Then you will launch a `httpClient`'s saga. That's all. | ||
By creating a new instance of `HttpClient`, you will get `api`, `authApi` objects and `saga` function. Then you connect the saga among your other sagas. That's all. | ||
@@ -47,8 +46,7 @@ ### 1. Create `httpClient` instance | ||
const httpClient = create({ | ||
const { api, authApi, saga } = create({ | ||
baseURL: 'https://base-url.com/api/', | ||
}); | ||
export const api = httpClient.api; | ||
export const authApi = httpClient.api; | ||
export { api, authApi, saga }; | ||
``` | ||
@@ -59,5 +57,6 @@ | ||
```js | ||
import { saga as httpClient } from 'ackee-http-client'; | ||
import { saga as httpClient } from 'Config/http-client'; | ||
export default function*() { | ||
// httpClient saga must come before redux-token-auth saga | ||
yield all([httpClient()]); | ||
@@ -110,7 +109,7 @@ } | ||
- `axiosRequestConfig` | ||
- `axiosRequestConfig: Object` | ||
The `axiosRequestConfig` is reserved for axios default request configuration, see [available options](https://github.com/axios/axios#request-config). | ||
- `customConfig` | ||
- `customConfig: Object` | ||
@@ -143,4 +142,6 @@ The `customConfig` object offers following default options: | ||
- <a name="api-create-http-client"></a>`httpClient` | ||
- <a name="api-create-http-client"></a>`httpClient: Object` | ||
#### `api`, `authApi` | ||
The `httpClient` object contains two axios instances: `api` and `authApi` with the same properties: | ||
@@ -160,2 +161,6 @@ | ||
#### `saga` | ||
Internal saga primarily for communication with `ackee-redux-token-auth`. | ||
#### Example | ||
@@ -190,19 +195,4 @@ | ||
### <a name="api-saga"></a>`saga(void) => ReduxSaga` | ||
Initializes the saga handlers generator. This should be passed along with your other sagas. | ||
#### Example | ||
```js | ||
import { all } from 'redux-saga/effects'; | ||
import { saga as httpClient } from 'ackee-http-client'; | ||
export default function*() { | ||
yield all([httpClient()]); | ||
} | ||
``` | ||
### <a name="api-saga-effects"></a> Saga Effects | ||
Custom Saga effects with built-in cancelation of API requests, [see the docs](https://gitlab.ack.ee/Web/http-client/blob/master/src/saga-effects/saga-effects.md). |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
785004
3500
191