ackee-http-client
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -19,2 +19,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
if (Store.get(Store.keys.IS_AUTH)) { | ||
_context.next = 5; | ||
break; | ||
} | ||
if (Store.get(Store.keys.SAGA_INITIALIZE)) { | ||
_context.next = 3; | ||
@@ -24,13 +29,16 @@ break; | ||
_context.next = 3; | ||
return take(actionTypes.ACCESS_TOKEN_AVAILABLE); | ||
throw new Error("ackee-http-client: The HTTP client's 'saga' must be connected among your other sagas."); | ||
case 3: | ||
_context.next = 5; | ||
return take(actionTypes.ACCESS_TOKEN_AVAILABLE); | ||
case 5: | ||
_context.next = 7; | ||
return methodHandler.apply(void 0, _args); | ||
case 5: | ||
case 7: | ||
return _context.abrupt("return", _context.sent); | ||
case 6: | ||
case 8: | ||
case "end": | ||
@@ -37,0 +45,0 @@ return _context.stop(); |
@@ -1,37 +0,4 @@ | ||
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regeneratorRuntime.mark(saga); | ||
import { all, call } from 'redux-saga/effects'; | ||
import manageAuthHeader from './manageAuthHeader'; | ||
import * as Store from './store'; | ||
export { default as create } from './create'; | ||
export { default as saga } from './sagas'; | ||
import * as _sagaEffects from './saga-effects'; | ||
export { _sagaEffects as sagaEffects }; | ||
export function saga() { | ||
var sagas, tasks; | ||
return _regeneratorRuntime.wrap(function saga$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
sagas = []; | ||
if (Store.get(Store.keys.CONFIG).manageAuthHeader) { | ||
sagas.push(manageAuthHeader); | ||
} | ||
tasks = sagas.map(function (fn) { | ||
return call(fn); | ||
}); | ||
_context.next = 5; | ||
return all(tasks); | ||
case 5: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _marked, this); | ||
} | ||
export { _sagaEffects as sagaEffects }; |
@@ -9,5 +9,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
AUTH_AXIOS: 'authAxios', | ||
CONFIG: 'config' | ||
CONFIG: 'config', | ||
SAGA_INITIALIZE: 'sagaInitialize' | ||
}; | ||
var state = (_state = {}, _defineProperty(_state, keys.IS_AUTH, false), _defineProperty(_state, keys.AUTH_AXIOS, null), _defineProperty(_state, keys.CONFIG, defaultConfig), _state); | ||
var state = (_state = {}, _defineProperty(_state, keys.IS_AUTH, false), _defineProperty(_state, keys.AUTH_AXIOS, null), _defineProperty(_state, keys.CONFIG, defaultConfig), _defineProperty(_state, keys.SAGA_INITIALIZE, false), _state); | ||
/** | ||
@@ -14,0 +15,0 @@ * @param {String} key |
@@ -36,2 +36,7 @@ "use strict"; | ||
if (Store.get(Store.keys.IS_AUTH)) { | ||
_context.next = 5; | ||
break; | ||
} | ||
if (Store.get(Store.keys.SAGA_INITIALIZE)) { | ||
_context.next = 3; | ||
@@ -41,13 +46,16 @@ break; | ||
_context.next = 3; | ||
return (0, _effects.take)(_ackeeReduxTokenAuth.actionTypes.ACCESS_TOKEN_AVAILABLE); | ||
throw new Error("ackee-http-client: The HTTP client's 'saga' must be connected among your other sagas."); | ||
case 3: | ||
_context.next = 5; | ||
return (0, _effects.take)(_ackeeReduxTokenAuth.actionTypes.ACCESS_TOKEN_AVAILABLE); | ||
case 5: | ||
_context.next = 7; | ||
return methodHandler.apply(void 0, _args); | ||
case 5: | ||
case 7: | ||
return _context.abrupt("return", _context.sent); | ||
case 6: | ||
case 8: | ||
case "end": | ||
@@ -54,0 +62,0 @@ return _context.stop(); |
@@ -10,3 +10,2 @@ "use strict"; | ||
}); | ||
exports.saga = saga; | ||
Object.defineProperty(exports, "create", { | ||
@@ -18,46 +17,16 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "saga", { | ||
enumerable: true, | ||
get: function get() { | ||
return _sagas.default; | ||
} | ||
}); | ||
exports.sagaEffects = void 0; | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var _create = _interopRequireDefault(require("./create")); | ||
var _effects = require("redux-saga/effects"); | ||
var _sagas = _interopRequireDefault(require("./sagas")); | ||
var _manageAuthHeader = _interopRequireDefault(require("./manageAuthHeader")); | ||
var Store = _interopRequireWildcard(require("./store")); | ||
var _create = _interopRequireDefault(require("./create")); | ||
var _sagaEffects = _interopRequireWildcard(require("./saga-effects")); | ||
exports.sagaEffects = _sagaEffects; | ||
var _marked = | ||
/*#__PURE__*/ | ||
_regenerator.default.mark(saga); | ||
function saga() { | ||
var sagas, tasks; | ||
return _regenerator.default.wrap(function saga$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
sagas = []; | ||
if (Store.get(Store.keys.CONFIG).manageAuthHeader) { | ||
sagas.push(_manageAuthHeader.default); | ||
} | ||
tasks = sagas.map(function (fn) { | ||
return (0, _effects.call)(fn); | ||
}); | ||
_context.next = 5; | ||
return (0, _effects.all)(tasks); | ||
case 5: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _marked, this); | ||
} | ||
exports.sagaEffects = _sagaEffects; |
@@ -19,6 +19,7 @@ "use strict"; | ||
AUTH_AXIOS: 'authAxios', | ||
CONFIG: 'config' | ||
CONFIG: 'config', | ||
SAGA_INITIALIZE: 'sagaInitialize' | ||
}; | ||
exports.keys = keys; | ||
var state = (_state = {}, (0, _defineProperty2.default)(_state, keys.IS_AUTH, false), (0, _defineProperty2.default)(_state, keys.AUTH_AXIOS, null), (0, _defineProperty2.default)(_state, keys.CONFIG, _defaultConfig.default), _state); | ||
var state = (_state = {}, (0, _defineProperty2.default)(_state, keys.IS_AUTH, false), (0, _defineProperty2.default)(_state, keys.AUTH_AXIOS, null), (0, _defineProperty2.default)(_state, keys.CONFIG, _defaultConfig.default), (0, _defineProperty2.default)(_state, keys.SAGA_INITIALIZE, false), _state); | ||
/** | ||
@@ -25,0 +26,0 @@ * @param {String} key |
{ | ||
"name": "ackee-http-client", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
785286
34
3503