@twreporter/redux
Advanced tools
Comparing version 5.0.0-beta.7 to 5.0.0-beta.8
@@ -9,6 +9,8 @@ "use strict"; | ||
var _apiConfig = _interopRequireDefault(require("../constants/api-config")); | ||
var _url = require("../utils/url"); | ||
var _actionTypes = _interopRequireDefault(require("../constants/action-types")); | ||
var _apiConfig = _interopRequireDefault(require("../constants/api-config")); | ||
var _axios = _interopRequireDefault(require("axios")); | ||
@@ -18,3 +20,3 @@ | ||
var _formApiUrl = _interopRequireDefault(require("../utils/form-api-url")); | ||
var _reduxStateFieldNames = _interopRequireDefault(require("../constants/redux-state-field-names")); | ||
@@ -30,5 +32,9 @@ var _get = _interopRequireDefault(require("lodash/get")); | ||
function getAccessToken(cookieList, releaseBranch) { | ||
return function (dispatch) { | ||
var endpoint = (0, _formApiUrl["default"])('/v2/auth/token', {}, releaseBranch); | ||
function getAccessToken(cookieList) { | ||
return function (dispatch, getState) { | ||
var state = getState(); | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var url = (0, _url.formURL)(apiOrigin, '/v2/auth/token'); | ||
var headers = {}; | ||
@@ -72,3 +78,3 @@ | ||
return _axios["default"].post(endpoint, null, options).then(function (axiosRes) { | ||
return _axios["default"].post(url, null, options).then(function (axiosRes) { | ||
dispatch({ | ||
@@ -75,0 +81,0 @@ type: _actionTypes["default"].AUTH_SUCCESS, |
@@ -17,2 +17,4 @@ "use strict"; | ||
var _url = require("../utils/url"); | ||
var _normalizr = require("normalizr"); | ||
@@ -24,6 +26,6 @@ | ||
var _formApiUrl = _interopRequireDefault(require("../utils/form-api-url")); | ||
var _httpProtocol = _interopRequireDefault(require("../constants/http-protocol")); | ||
var _reduxStateFieldNames = _interopRequireDefault(require("../constants/redux-state-field-names")); | ||
var _get = _interopRequireDefault(require("lodash/get")); | ||
@@ -68,3 +70,7 @@ | ||
}; | ||
var url = (0, _formApiUrl["default"])("/v1/search/posts", searchParas, undefined, false); | ||
var state = getState(); | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var url = (0, _url.formURL)(apiOrigin, "/v1/search/posts", searchParas, false); | ||
dispatch(requestAuthorCollection(authorId)); | ||
@@ -71,0 +77,0 @@ return (0, _isomorphicFetch["default"])(url).then(function (response) { |
@@ -15,2 +15,4 @@ "use strict"; | ||
var _url = require("../utils/url"); | ||
var _normalizr = require("normalizr"); | ||
@@ -22,10 +24,13 @@ | ||
var _formApiUrl = _interopRequireDefault(require("../utils/form-api-url")); | ||
var _reduxStateFieldNames = _interopRequireDefault(require("../constants/redux-state-field-names")); | ||
var _assign = _interopRequireDefault(require("lodash/assign")); | ||
var _get = _interopRequireDefault(require("lodash/get")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _ = { | ||
assign: _assign["default"] | ||
assign: _assign["default"], | ||
get: _get["default"] | ||
}; | ||
@@ -55,3 +60,3 @@ | ||
function fetchAuthorDetails(authorId) { | ||
return function (dispatch) { | ||
return function (dispatch, getState) { | ||
var searchParas = { | ||
@@ -63,3 +68,7 @@ keywords: authorId, | ||
}; | ||
var url = (0, _formApiUrl["default"])('/v1/search/authors', searchParas, undefined, false); | ||
var state = getState(); | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var url = (0, _url.formURL)(apiOrigin, '/v1/search/authors', searchParas, false); | ||
dispatch(requestFetchAuthorDetails(authorId)); | ||
@@ -66,0 +75,0 @@ return (0, _isomorphicFetch["default"])(url).then(function (res) { |
@@ -17,2 +17,4 @@ "use strict"; | ||
var _url = require("../utils/url"); | ||
var _normalizr = require("normalizr"); | ||
@@ -24,6 +26,6 @@ | ||
var _formApiUrl = _interopRequireDefault(require("../utils/form-api-url")); | ||
var _httpProtocol = _interopRequireDefault(require("../constants/http-protocol")); | ||
var _reduxStateFieldNames = _interopRequireDefault(require("../constants/redux-state-field-names")); | ||
var _assign = _interopRequireDefault(require("lodash/assign")); | ||
@@ -76,3 +78,7 @@ | ||
}; | ||
var url = (0, _formApiUrl["default"])('/v1/search/authors', searchParas, undefined, false); | ||
var state = getState(); | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var url = (0, _url.formURL)(apiOrigin, '/v1/search/authors', searchParas, false); | ||
dispatch(requestSearchAuthors(keywords)); | ||
@@ -79,0 +85,0 @@ return (0, _isomorphicFetch["default"])(url).then(function (response) { |
@@ -11,2 +11,4 @@ "use strict"; | ||
var _url = require("../utils/url"); | ||
var _apiConfig = _interopRequireDefault(require("../constants/api-config")); | ||
@@ -16,3 +18,3 @@ | ||
var _formApiUrl = _interopRequireDefault(require("../utils/form-api-url")); | ||
var _reduxStateFieldNames = _interopRequireDefault(require("../constants/redux-state-field-names")); | ||
@@ -56,3 +58,7 @@ var _actionTypes = _interopRequireDefault(require("../constants/action-types")); | ||
var httpClientWithToken = _ref.httpClientWithToken; | ||
var url = (0, _formApiUrl["default"])("/v1/users/".concat(userID, "/bookmarks"), {}, undefined, false); | ||
var state = getState(); | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var url = (0, _url.formURL)(apiOrigin, "/v1/users/".concat(userID, "/bookmarks"), {}, false); | ||
var axiosConfig = { | ||
@@ -98,3 +104,3 @@ timeout: apiTimeout, | ||
var httpClientWithToken = _ref2.httpClientWithToken; | ||
var url = (0, _formApiUrl["default"])("/v1/users/".concat(userID, "/bookmarks"), { | ||
var url = (0, _url.formURL)("/v1/users/".concat(userID, "/bookmarks"), { | ||
offset: offset, | ||
@@ -141,3 +147,3 @@ limit: limit, | ||
var httpClientWithToken = _ref3.httpClientWithToken; | ||
var url = (0, _formApiUrl["default"])("/v1/users/".concat(userID, "/bookmarks/").concat(bookmarkSlug), { | ||
var url = (0, _url.formURL)("/v1/users/".concat(userID, "/bookmarks/").concat(bookmarkSlug), { | ||
host: bookmarkHost | ||
@@ -182,3 +188,3 @@ }, undefined, false); | ||
var httpClientWithToken = _ref4.httpClientWithToken; | ||
var url = (0, _formApiUrl["default"])("/v1/users/".concat(userID, "/bookmarks/").concat(bookmarkID), {}, undefined, false); | ||
var url = (0, _url.formURL)("/v1/users/".concat(userID, "/bookmarks/").concat(bookmarkID), {}, undefined, false); | ||
var axiosConfig = { | ||
@@ -185,0 +191,0 @@ timeout: apiTimeout, |
@@ -9,2 +9,4 @@ "use strict"; | ||
var _url = require("../utils/url"); | ||
var _apiConfig = _interopRequireDefault(require("../constants/api-config")); | ||
@@ -18,4 +20,2 @@ | ||
var _formApiUrl = _interopRequireDefault(require("../utils/form-api-url")); | ||
var _actionTypes = _interopRequireDefault(require("../constants/action-types")); | ||
@@ -34,4 +34,4 @@ | ||
function _fetch(dispatch, path, params) { | ||
var url = (0, _formApiUrl["default"])(path, params); | ||
function _fetch(dispatch, origin, path, params) { | ||
var url = (0, _url.formURL)(origin, path, params); | ||
dispatch({ | ||
@@ -77,3 +77,5 @@ type: _actionTypes["default"].START_TO_GET_INDEX_PAGE_CONTENT, | ||
return _fetch(dispatch, "/v1/".concat(_apiEndpoints["default"].indexPage)); | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
return _fetch(dispatch, apiOrigin, "/v1/".concat(_apiEndpoints["default"].indexPage)); | ||
}; | ||
@@ -101,4 +103,6 @@ } | ||
return _fetch(dispatch, "/v1/".concat(_apiEndpoints["default"].indexPageCategories)); | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
return _fetch(dispatch, apiOrigin, "/v1/".concat(_apiEndpoints["default"].indexPageCategories)); | ||
}; | ||
} |
@@ -12,2 +12,4 @@ "use strict"; | ||
var _url = require("../utils/url"); | ||
var _apiConfig = _interopRequireDefault(require("../constants/api-config")); | ||
@@ -19,8 +21,6 @@ | ||
var _postStyles = _interopRequireDefault(require("../constants/post-styles")); | ||
var _reduxStateFieldNames = _interopRequireDefault(require("../constants/redux-state-field-names")); | ||
var _formApiUrl = _interopRequireDefault(require("../utils/form-api-url")); | ||
var _postStyles = _interopRequireDefault(require("../constants/post-styles")); | ||
var _actionTypes = _interopRequireDefault(require("../constants/action-types")); | ||
@@ -58,4 +58,6 @@ | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var path = "/v1/".concat(_apiEndpoints["default"].posts, "/").concat(slug); | ||
var url = (0, _formApiUrl["default"])(path, { | ||
var url = (0, _url.formURL)(apiOrigin, path, { | ||
full: 'true' | ||
@@ -88,9 +90,9 @@ }); | ||
function _fetchPosts(dispatch) { | ||
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var successActionType = arguments.length > 3 ? arguments[3] : undefined; | ||
var failureActionType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _actionTypes["default"].ERROR_TO_GET_POSTS; | ||
var defaultPayload = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {}; | ||
var url = (0, _formApiUrl["default"])(path, params); | ||
function _fetchPosts(dispatch, origin) { | ||
var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
var params = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
var successActionType = arguments.length > 4 ? arguments[4] : undefined; | ||
var failureActionType = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _actionTypes["default"].ERROR_TO_GET_POSTS; | ||
var defaultPayload = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {}; | ||
var url = (0, _url.formURL)(origin, path, params); | ||
dispatch({ | ||
@@ -139,2 +141,5 @@ type: _actionTypes["default"].START_TO_GET_POSTS, | ||
var offset = page > 0 ? (page - 1) * limit : _.get(list, 'items.length', 0); | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var path = "/v1/".concat(_apiEndpoints["default"].posts); | ||
@@ -146,3 +151,3 @@ var params = { | ||
}; | ||
return _fetchPosts(dispatch, path, params, _actionTypes["default"].GET_LISTED_POSTS, _actionTypes["default"].ERROR_TO_GET_LISTED_POSTS, { | ||
return _fetchPosts(dispatch, apiOrigin, path, params, _actionTypes["default"].GET_LISTED_POSTS, _actionTypes["default"].ERROR_TO_GET_LISTED_POSTS, { | ||
listID: listID, | ||
@@ -164,2 +169,4 @@ page: page | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var path = "/v1/".concat(_apiEndpoints["default"].posts); | ||
@@ -170,3 +177,3 @@ var params = { | ||
}; | ||
return _fetchPosts(dispatch, path, params, _actionTypes["default"].GET_EDITOR_PICKED_POSTS); | ||
return _fetchPosts(dispatch, apiOrigin, path, params, _actionTypes["default"].GET_EDITOR_PICKED_POSTS); | ||
}; | ||
@@ -185,2 +192,4 @@ } | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var path = "/v1/".concat(_apiEndpoints["default"].posts); | ||
@@ -191,3 +200,3 @@ var params = { | ||
}; | ||
return _fetchPosts(dispatch, path, params, _actionTypes["default"].GET_PHOTOGRAPHY_POSTS_FOR_INDEX_PAGE); | ||
return _fetchPosts(dispatch, apiOrigin, path, params, _actionTypes["default"].GET_PHOTOGRAPHY_POSTS_FOR_INDEX_PAGE); | ||
}; | ||
@@ -206,2 +215,4 @@ } | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var path = "/v1/".concat(_apiEndpoints["default"].posts); | ||
@@ -212,4 +223,4 @@ var params = { | ||
}; | ||
return _fetchPosts(dispatch, path, params, _actionTypes["default"].GET_INFOGRAPHIC_POSTS_FOR_INDEX_PAGE); | ||
return _fetchPosts(dispatch, apiOrigin, path, params, _actionTypes["default"].GET_INFOGRAPHIC_POSTS_FOR_INDEX_PAGE); | ||
}; | ||
} |
@@ -10,18 +10,18 @@ "use strict"; | ||
var _apiConfig = _interopRequireDefault(require("../constants/api-config")); | ||
var _error = require("../utils/error"); | ||
var _axios = _interopRequireDefault(require("axios")); | ||
var _url = require("../utils/url"); | ||
var _reduxStateFieldNames = _interopRequireDefault(require("../constants/redux-state-field-names")); | ||
var _apiConfig = _interopRequireDefault(require("../constants/api-config")); | ||
var _apiEndpoints = _interopRequireDefault(require("../constants/api-endpoints")); | ||
var _formApiUrl = _interopRequireDefault(require("../utils/form-api-url")); | ||
var _axios = _interopRequireDefault(require("axios")); | ||
var _actionTypes = _interopRequireDefault(require("../constants/action-types")); | ||
var _pagination = _interopRequireDefault(require("../utils/pagination")); | ||
var _error = require("../utils/error"); | ||
var _reduxStateFieldNames = _interopRequireDefault(require("../constants/redux-state-field-names")); | ||
var _actionTypes = _interopRequireDefault(require("../constants/action-types")); | ||
var _get = _interopRequireDefault(require("lodash/get")); | ||
@@ -43,3 +43,3 @@ | ||
var topic = _.get(state, "".concat(_reduxStateFieldNames["default"].entities, ".").concat(_reduxStateFieldNames["default"].topicsInEntities, ".").concat(slug), {}); | ||
var topic = _.get(state, [_reduxStateFieldNames["default"].entities, _reduxStateFieldNames["default"].topicsInEntities, slug], {}); | ||
@@ -54,2 +54,4 @@ if (_.get(topic, 'full', false)) { | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var path = "/v1/".concat(_apiEndpoints["default"].topics, "/").concat(slug); | ||
@@ -65,3 +67,3 @@ var params = { | ||
}); | ||
return _axios["default"].get((0, _formApiUrl["default"])(path, params), { | ||
return _axios["default"].get((0, _url.formURL)(apiOrigin, path, params), { | ||
timeout: _apiConfig["default"].timeout | ||
@@ -85,4 +87,4 @@ }).then(function (response) { | ||
function _fetchTopics(dispatch, path, params, successActionType) { | ||
var url = (0, _formApiUrl["default"])(path, params); | ||
function _fetchTopics(dispatch, origin, path, params, successActionType) { | ||
var url = (0, _url.formURL)(origin, path, params); | ||
dispatch({ | ||
@@ -122,3 +124,3 @@ type: _actionTypes["default"].START_TO_GET_TOPICS, | ||
var nPerPage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5; | ||
return function (dispatch) { | ||
return function (dispatch, getState) { | ||
if (!_.isInteger(nPerPage) || nPerPage <= 0) { | ||
@@ -142,2 +144,6 @@ var err = new _error.BadRequestError("nPerPage value must be an interger larger than 0, but is ".concat(nPerPage)); | ||
var state = getState(); | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var path = "/v1/".concat(_apiEndpoints["default"].topics); | ||
@@ -148,3 +154,3 @@ var params = { | ||
}; | ||
return _fetchTopics(dispatch, path, params, _actionTypes["default"].GET_TOPICS); | ||
return _fetchTopics(dispatch, apiOrigin, path, params, _actionTypes["default"].GET_TOPICS); | ||
}; | ||
@@ -163,2 +169,4 @@ } | ||
var apiOrigin = _.get(state, [_reduxStateFieldNames["default"].origins, 'api']); | ||
var path = "/v1/".concat(_apiEndpoints["default"].topics); | ||
@@ -169,4 +177,4 @@ var params = { | ||
}; | ||
return _fetchTopics(dispatch, path, params, _actionTypes["default"].GET_TOPICS_FOR_INDEX_PAGE); | ||
return _fetchTopics(dispatch, apiOrigin, path, params, _actionTypes["default"].GET_TOPICS_FOR_INDEX_PAGE); | ||
}; | ||
} |
@@ -70,4 +70,7 @@ "use strict"; | ||
} | ||
}, | ||
origins: { | ||
update: 'update request origins' | ||
} | ||
}; | ||
exports["default"] = _default; |
@@ -36,2 +36,3 @@ "use strict"; | ||
var topicsInEntities = 'topics'; | ||
var origins = 'origins'; | ||
var _default = { | ||
@@ -63,2 +64,3 @@ categories: { | ||
topicsInEntities: topicsInEntities, | ||
origins: origins, | ||
articlesByAuthor: articlesByAuthor, | ||
@@ -65,0 +67,0 @@ auth: auth, |
@@ -10,2 +10,4 @@ "use strict"; | ||
var _url = require("./utils/url"); | ||
var _posts = require("./reducers/posts"); | ||
@@ -23,4 +25,2 @@ | ||
var _formApiUrl = _interopRequireDefault(require("./utils/form-api-url")); | ||
var _indexPage = _interopRequireDefault(require("./reducers/index-page")); | ||
@@ -56,3 +56,3 @@ | ||
denormalizeTopics: _denormalizeAsset.denormalizeTopics, | ||
formAPIURL: _formApiUrl["default"], | ||
formURL: _url.formURL, | ||
pagination: _pagination["default"] | ||
@@ -59,0 +59,0 @@ } |
@@ -28,2 +28,4 @@ "use strict"; | ||
var _origins = _interopRequireDefault(require("./origins")); | ||
var _reduxStateFieldNames = _interopRequireDefault(require("../constants/redux-state-field-names")); | ||
@@ -73,4 +75,4 @@ | ||
return state; | ||
}), _combineReducers)); | ||
}), _defineProperty(_combineReducers, _reduxStateFieldNames["default"].origins, _origins["default"]), _combineReducers)); | ||
var _default = rootReducer; | ||
exports["default"] = _default; |
@@ -40,5 +40,4 @@ "use strict"; | ||
_createStore2 = _asyncToGenerator(regeneratorRuntime.mark(function _callee() { | ||
var initialState, | ||
var preloadedState, | ||
cookie, | ||
isDev, | ||
httpClientWithToken, | ||
@@ -48,4 +47,6 @@ composeEnhancers, | ||
reduxState, | ||
_store, | ||
store, | ||
_args = arguments; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -55,5 +56,4 @@ while (1) { | ||
case 0: | ||
initialState = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}; | ||
preloadedState = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}; | ||
cookie = _args.length > 1 && _args[1] !== undefined ? _args[1] : ''; | ||
isDev = _args.length > 2 && _args[2] !== undefined ? _args[2] : false; | ||
httpClientWithToken = cookie ? _axios["default"].create({ | ||
@@ -72,37 +72,31 @@ headers: { | ||
if (!_detectEnv["default"].isBrowser()) { | ||
_context.next = 21; | ||
_context.next = 19; | ||
break; | ||
} | ||
_context.prev = 7; | ||
_context.next = 10; | ||
return _browserStorage["default"].syncReduxState(initialState); | ||
_context.prev = 6; | ||
_context.next = 9; | ||
return _browserStorage["default"].syncReduxState(preloadedState); | ||
case 10: | ||
case 9: | ||
reduxState = _context.sent; | ||
store = (0, _redux.createStore)(_reducers["default"], reduxState, storeEnhancer); | ||
_store = (0, _redux.createStore)(_reducers["default"], reduxState, storeEnhancer); | ||
if (isDev && module.hot) { | ||
module.hot.accept('../reducers', function () { | ||
var nextRootReducer = require('../reducers')["default"]; | ||
_store.subscribe(_.debounce(function () { | ||
_browserStorage["default"].syncReduxState(_store.getState()); | ||
}, 1000)); | ||
store.replaceReducer(nextRootReducer); | ||
}); | ||
} | ||
return _context.abrupt("return", _store); | ||
store.subscribe(_.throttle(function () { | ||
_browserStorage["default"].syncReduxState(store.getState()); | ||
}, 1000)); | ||
case 15: | ||
_context.prev = 15; | ||
_context.t0 = _context["catch"](6); | ||
console.error('Sync-ing with browser storage occurs error:', _context.t0); | ||
return _context.abrupt("return", (0, _redux.createStore)(_reducers["default"], preloadedState, storeEnhancer)); | ||
case 19: | ||
store = (0, _redux.createStore)(_reducers["default"], preloadedState, storeEnhancer); | ||
return _context.abrupt("return", store); | ||
case 17: | ||
_context.prev = 17; | ||
_context.t0 = _context["catch"](7); | ||
console.error('Sync-ing with browser storage occurs error:', _context.t0); | ||
return _context.abrupt("return", (0, _redux.createStore)(_reducers["default"], initialState, storeEnhancer)); | ||
case 21: | ||
return _context.abrupt("return", (0, _redux.createStore)(_reducers["default"], initialState, storeEnhancer)); | ||
case 22: | ||
case "end": | ||
@@ -112,5 +106,5 @@ return _context.stop(); | ||
} | ||
}, _callee, null, [[7, 17]]); | ||
}, _callee, null, [[6, 15]]); | ||
})); | ||
return _createStore2.apply(this, arguments); | ||
} |
@@ -155,5 +155,5 @@ "use strict"; | ||
function getReduxState() { | ||
function getStateFromStorage() { | ||
if (!_detectEnv["default"].isBrowser()) { | ||
return Promise.reject(new Error('getReduxState function should be executed on client side')); | ||
return Promise.reject(new Error('`getStateFromStorage` function should be executed on client side')); | ||
} | ||
@@ -171,6 +171,5 @@ | ||
var maxAge, | ||
chacheableNewState, | ||
cacheableNewState, | ||
toCacheState, | ||
oldCachedState, | ||
nextCachedState, | ||
_args4 = arguments; | ||
@@ -182,3 +181,3 @@ return regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
maxAge = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : 600; | ||
chacheableNewState = _.pick(newReduxState, cacheableProps); | ||
cacheableNewState = _.pick(newReduxState, cacheableProps); | ||
_context4.next = 4; | ||
@@ -193,3 +192,3 @@ return isReduxStateExpired(); | ||
toCacheState = chacheableNewState; | ||
toCacheState = cacheableNewState; | ||
_context4.next = 12; | ||
@@ -200,21 +199,14 @@ break; | ||
_context4.next = 10; | ||
return getReduxState(); | ||
return getStateFromStorage(); | ||
case 10: | ||
oldCachedState = _context4.sent; | ||
toCacheState = _.merge(oldCachedState, chacheableNewState, _.pick(oldCachedState, cachedFirstProps)); | ||
toCacheState = _.merge({}, cacheableNewState, _.pick(oldCachedState, cachedFirstProps)); | ||
case 12: | ||
_context4.next = 14; | ||
return setReduxState(toCacheState); | ||
setReduxState(toCacheState); | ||
setReduxStateExpires(maxAge); | ||
return _context4.abrupt("return", newReduxState); | ||
case 14: | ||
nextCachedState = _context4.sent; | ||
_context4.next = 17; | ||
return setReduxStateExpires(maxAge); | ||
case 17: | ||
return _context4.abrupt("return", nextCachedState); | ||
case 18: | ||
case 15: | ||
case "end": | ||
@@ -230,3 +222,3 @@ return _context4.stop(); | ||
var _default = { | ||
getReduxState: getReduxState, | ||
getStateFromStorage: getStateFromStorage, | ||
isReduxStateExpired: isReduxStateExpired, | ||
@@ -233,0 +225,0 @@ syncReduxState: syncReduxState |
{ | ||
"name": "@twreporter/redux", | ||
"version": "5.0.0-beta.7", | ||
"version": "5.0.0-beta.8", | ||
"description": "redux actions and reducers for twreporter website", | ||
@@ -39,3 +39,4 @@ "main": "lib/index.js", | ||
"qs": "^6.5.1", | ||
"redux": "^3.6.0" | ||
"redux": "^4.0.1", | ||
"redux-thunk": "^2.3.0" | ||
}, | ||
@@ -73,3 +74,2 @@ "peerDependencies": { | ||
"redux-mock-store": "^1.2.3", | ||
"redux-thunk": "^2.2.0", | ||
"rimraf": "^2.6.1" | ||
@@ -76,0 +76,0 @@ }, |
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
137404
27
51
3011
12
+ Addedredux-thunk@^2.3.0
+ Added@babel/runtime@7.26.0(transitive)
+ Addedredux@4.2.1(transitive)
+ Addedredux-thunk@2.4.2(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
- Removedlodash-es@4.17.21(transitive)
- Removedredux@3.7.2(transitive)
- Removedsymbol-observable@1.2.0(transitive)
Updatedredux@^4.0.1