@twreporter/redux
Advanced tools
Comparing version 7.0.0-rc.0 to 7.0.0-rc.1
@@ -6,2 +6,16 @@ # Change Log | ||
# [7.0.0-rc.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/redux@7.0.0-rc.0...@twreporter/redux@7.0.0-rc.1) (2020-07-21) | ||
### Bug Fixes | ||
* **redux:** address JSDoc ([c21f7d9](https://github.com/twreporter/twreporter-npm-packages/commit/c21f7d9bc14efbdf3afcf3a1bdfe49b5618c42d2)) | ||
* **redux:** fix fetchAFullPost action ([7d60e19](https://github.com/twreporter/twreporter-npm-packages/commit/7d60e19a6f86e1fc2777ce5c8fad1c63e755e46a)) | ||
* **redux:** fix fetchAFullTopic action ([a47f316](https://github.com/twreporter/twreporter-npm-packages/commit/a47f316505acd668b08501323fb0390edc30e60d)) | ||
* **redux:** fix json path of related-posts-of reducer ([7fefd37](https://github.com/twreporter/twreporter-npm-packages/commit/7fefd37b17e8309fc98ba9a5c538d50db10aace3)) | ||
# [7.0.0-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/redux@6.1.0-rc.0...@twreporter/redux@7.0.0-rc.0) (2020-07-14) | ||
@@ -8,0 +22,0 @@ |
@@ -40,2 +40,4 @@ "use strict"; | ||
}; | ||
var entities = _reduxStateFieldNames["default"].entities, | ||
postsInEntities = _reduxStateFieldNames["default"].postsInEntities; | ||
/* Fetch a full post, whose assets like relateds, leading_video ...etc are all complete, | ||
@@ -50,5 +52,7 @@ * @param {string} slug - slug of post | ||
var post = _.get(state, "".concat(_reduxStateFieldNames["default"].entities, ".").concat(_reduxStateFieldNames["default"].postsInEntities, ".").concat(slug), {}); // post is already fully fetched | ||
var postId = _.get(state, [entities, postsInEntities, 'slugToId', slug], ''); | ||
var post = _.get(state, [entities, postsInEntities, 'byId', postId], null); // post is already fully fetched | ||
if (_.get(post, 'full', false)) { | ||
@@ -59,3 +63,3 @@ // current selected post is not the post just been fetched, | ||
var successAction = { | ||
type: _actionTypes["default"].CHANGE_SELECTED_POST, | ||
type: _actionTypes["default"].selectedPost.read.alreadyExists, | ||
payload: { | ||
@@ -93,3 +97,3 @@ post: post | ||
dispatch({ | ||
type: _actionTypes["default"].START_TO_GET_A_FULL_POST, | ||
type: _actionTypes["default"].selectedPost.read.request, | ||
payload: { | ||
@@ -103,3 +107,3 @@ slug: slug | ||
var successAction = { | ||
type: _actionTypes["default"].GET_A_FULL_POST, | ||
type: _actionTypes["default"].selectedPost.read.success, | ||
payload: { | ||
@@ -112,3 +116,3 @@ post: _.get(response, 'data.data', {}) | ||
})["catch"](function (error) { | ||
var failAction = _errorActionCreators["default"].axios(error, _actionTypes["default"].ERROR_TO_GET_A_FULL_POST); | ||
var failAction = _errorActionCreators["default"].axios(error, _actionTypes["default"].selectedPost.read.failure); | ||
@@ -115,0 +119,0 @@ failAction.payload.slug = slug; |
@@ -46,9 +46,13 @@ "use strict"; | ||
return function (dispatch, getState) { | ||
var entities = _reduxStateFieldNames["default"].entities, | ||
topicsInEntities = _reduxStateFieldNames["default"].topicsInEntities; | ||
var state = getState(); | ||
var topic = _.get(state, [_reduxStateFieldNames["default"].entities, _reduxStateFieldNames["default"].topicsInEntities, slug], {}); | ||
var topicId = _.get(state, [entities, topicsInEntities, 'slugToId', slug], ''); | ||
var topic = _.get(state, [entities, topicsInEntities, 'byId', topicId], null); | ||
if (_.get(topic, 'full', false)) { | ||
var successAction = { | ||
type: _actionTypes["default"].CHANGE_SELECTED_TOPIC, | ||
type: _actionTypes["default"].selectedTopic.read.alreadyExists, | ||
payload: { | ||
@@ -70,3 +74,3 @@ topic: topic | ||
dispatch({ | ||
type: _actionTypes["default"].START_TO_GET_A_FULL_TOPIC, | ||
type: _actionTypes["default"].selectedTopic.read.request, | ||
payload: { | ||
@@ -80,3 +84,3 @@ slug: slug | ||
var successAction = { | ||
type: _actionTypes["default"].GET_A_FULL_TOPIC, | ||
type: _actionTypes["default"].selectedTopic.read.success, | ||
payload: { | ||
@@ -89,3 +93,3 @@ topic: _.get(response, 'data.data', {}) | ||
})["catch"](function (error) { | ||
var failAction = _errorActionCreators["default"].axios(error, _actionTypes["default"].ERROR_TO_GET_A_FULL_TOPIC); | ||
var failAction = _errorActionCreators["default"].axios(error, _actionTypes["default"].selectedTopic.read.failure); | ||
@@ -92,0 +96,0 @@ failAction.payload.slug = slug; |
@@ -13,13 +13,2 @@ "use strict"; | ||
AUTH_CLEAR: 'clear_authorization', | ||
// change selected post | ||
CHANGE_SELECTED_POST: 'CHANGE_SELECTED_POST', | ||
CHANGE_SELECTED_TOPIC: 'CHANGE_SELECTED_TOPIC', | ||
// actions fetching a full topic | ||
START_TO_GET_A_FULL_TOPIC: 'START_TO_GET_A_FULL_TOPIC', | ||
ERROR_TO_GET_A_FULL_TOPIC: 'ERROR_TO_GET_A_FULL_TOPIC', | ||
GET_A_FULL_TOPIC: 'GET_A_FULL_TOPIC', | ||
// actions fetching a full post | ||
START_TO_GET_A_FULL_POST: 'START_TO_GET_A_FULL_POST', | ||
ERROR_TO_GET_A_FULL_POST: 'ERROR_TO_GET_A_FULL_POST', | ||
GET_A_FULL_POST: 'GET_A_FULL_POST', | ||
FETCH_AUTHOR_DETAILS_REQUEST: 'FETCH_AUTHOR_DETAILS_REQUEST', | ||
@@ -38,2 +27,18 @@ FETCH_AUTHOR_DETAILS_SUCCESS: 'FETCH_AUTHOR_DETAILS_SUCCESS', | ||
SET_NEXT_POPUP_TIME_STAMP: 'SET_NEXT_POPUP_TIME_STAMP', | ||
selectedPost: { | ||
read: { | ||
request: 'request to fetch the post', | ||
success: 'success to fetch the post', | ||
failure: 'fail to fetch the post', | ||
alreadyExists: 'the post is already existed' | ||
} | ||
}, | ||
selectedTopic: { | ||
read: { | ||
request: 'request to fetch the topic', | ||
success: 'success to fetch the topic', | ||
failure: 'fail to fetch the topic', | ||
alreadyExists: 'the topic is already existed' | ||
} | ||
}, | ||
indexPage: { | ||
@@ -40,0 +45,0 @@ read: { |
@@ -152,3 +152,3 @@ "use strict"; | ||
case _actionTypes["default"].GET_A_FULL_POST: | ||
case _actionTypes["default"].selectedPost.read.success: | ||
{ | ||
@@ -162,3 +162,3 @@ var _allPostIds = _.get(state, [_reduxStateFieldNames["default"].postsInEntities, 'allIds'], []); | ||
case _actionTypes["default"].GET_A_FULL_TOPIC: | ||
case _actionTypes["default"].selectedTopic.read.success: | ||
{ | ||
@@ -165,0 +165,0 @@ var _allTopicIds2 = _.get(state, [_reduxStateFieldNames["default"].topicsInEntities, 'allIds'], []); |
@@ -35,4 +35,4 @@ "use strict"; | ||
switch (action.type) { | ||
case _actionTypes["default"].GET_A_FULL_POST: | ||
case _actionTypes["default"].CHANGE_SELECTED_POST: | ||
case _actionTypes["default"].selectedPost.read.success: | ||
case _actionTypes["default"].selectedPost.read.alreadyExists: | ||
{ | ||
@@ -46,3 +46,3 @@ return { | ||
case _actionTypes["default"].START_TO_GET_A_FULL_POST: | ||
case _actionTypes["default"].selectedPost.read.request: | ||
return { | ||
@@ -54,3 +54,3 @@ isFetching: true, | ||
case _actionTypes["default"].ERROR_TO_GET_A_FULL_POST: | ||
case _actionTypes["default"].selectedPost.read.failure: | ||
return action.payload; | ||
@@ -57,0 +57,0 @@ |
@@ -48,3 +48,3 @@ "use strict"; | ||
switch (_.get(action, 'type', '')) { | ||
case _actionTypes["default"].GET_A_FULL_TOPIC: | ||
case _actionTypes["default"].selectedTopic.read.success: | ||
{ | ||
@@ -86,3 +86,3 @@ var topic = _.get(action, 'payload.topic', {}); | ||
case _actionTypes["default"].GET_A_FULL_POST: | ||
case _actionTypes["default"].selectedPost.read.success: | ||
{ | ||
@@ -99,3 +99,3 @@ var post = _.get(action, 'payload.post', {}); | ||
var topicRelateds = _.get(post, 'topics.relateds', []); | ||
var topicRelateds = _.get(post, 'topic.relateds', []); | ||
@@ -102,0 +102,0 @@ var _more = []; |
@@ -41,4 +41,4 @@ "use strict"; | ||
switch (action.type) { | ||
case _actionTypes["default"].GET_A_FULL_TOPIC: | ||
case _actionTypes["default"].CHANGE_SELECTED_TOPIC: | ||
case _actionTypes["default"].selectedTopic.read.success: | ||
case _actionTypes["default"].selectedTopic.read.alreadyExists: | ||
{ | ||
@@ -52,3 +52,3 @@ return _.merge({}, state, { | ||
case _actionTypes["default"].START_TO_GET_A_FULL_TOPIC: | ||
case _actionTypes["default"].selectedTopic.read.request: | ||
return _.merge({}, state, { | ||
@@ -60,3 +60,3 @@ slug: _.get(action, 'payload.slug'), | ||
case _actionTypes["default"].ERROR_TO_GET_A_FULL_TOPIC: | ||
case _actionTypes["default"].selectedTopic.read.failure: | ||
return _.merge({}, state, { | ||
@@ -63,0 +63,0 @@ slug: _.get(action, 'payload.slug'), |
@@ -86,3 +86,3 @@ /** | ||
* @property {string} short_title | ||
* @property {string} updated_at | ||
* @property {string} published_date | ||
*/ | ||
@@ -101,3 +101,3 @@ | ||
* @property {string} short_title | ||
* @property {string} updated_at | ||
* @property {string} published_date | ||
* | ||
@@ -112,3 +112,2 @@ * @property {Object} description | ||
* @property {string} og_title | ||
* @property {string} published_date | ||
* @property {string} relateds_background | ||
@@ -118,2 +117,3 @@ * @property {string} relateds_format | ||
* @property {string} title_position | ||
* @property {string} updated_at | ||
*/ | ||
@@ -120,0 +120,0 @@ |
{ | ||
"name": "@twreporter/redux", | ||
"version": "7.0.0-rc.0", | ||
"version": "7.0.0-rc.1", | ||
"description": "redux actions and reducers for twreporter website", | ||
@@ -46,3 +46,3 @@ "repository": "https://github.com/twreporter/twreporter-npm-packages.git", | ||
], | ||
"gitHead": "148a1e0794decc1878e60093d7ade86623a4c56a" | ||
"gitHead": "7ec6a1fc2ca6376aed8e1abcf3da3fa595db9f28" | ||
} |
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
190904
4336