Fix javascript tests
This commit is contained in:
parent
284f64d202
commit
f5f7f99f71
1 changed files with 11 additions and 11 deletions
|
|
@ -39,14 +39,14 @@ export const categories = (state = { ...defaultState }, action) => {
|
|||
case REQUEST_CATEGORY:
|
||||
return { ...state, isFetching: true };
|
||||
case MARK_POST_READ:
|
||||
let category = {};
|
||||
let postCategory = {};
|
||||
|
||||
switch (action.section.type) {
|
||||
case CATEGORY_TYPE:
|
||||
category = { ...state.items[action.section.id] };
|
||||
postCategory = { ...state.items[action.section.id] };
|
||||
break;
|
||||
case RULE_TYPE:
|
||||
category = { ...state.items[action.section.category] };
|
||||
postCategory = { ...state.items[action.section.category] };
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -54,33 +54,33 @@ export const categories = (state = { ...defaultState }, action) => {
|
|||
...state,
|
||||
items: {
|
||||
...state.items,
|
||||
[category.id]: { ...category, unread: category.unread - 1 },
|
||||
[postCategory.id]: { ...postCategory, unread: postCategory.unread - 1 },
|
||||
},
|
||||
};
|
||||
case MARK_SECTION_READ:
|
||||
category = {};
|
||||
let sectionCategory = {};
|
||||
|
||||
switch (action.section.type) {
|
||||
case CATEGORY_TYPE:
|
||||
category = { ...state.items[action.section.id] };
|
||||
sectionCategory = { ...state.items[action.section.id] };
|
||||
|
||||
return {
|
||||
...state,
|
||||
items: {
|
||||
...state.items,
|
||||
[category.id]: { ...category, unread: 0 },
|
||||
[sectionCategory.id]: { ...sectionCategory, unread: 0 },
|
||||
},
|
||||
};
|
||||
case RULE_TYPE:
|
||||
category = { ...state.items[action.section.category] };
|
||||
sectionCategory = { ...state.items[action.section.category] };
|
||||
|
||||
return {
|
||||
...state,
|
||||
items: {
|
||||
...state.items,
|
||||
[category.id]: {
|
||||
...category,
|
||||
unread: category.unread - action.section.unread,
|
||||
[sectionCategory.id]: {
|
||||
...sectionCategory,
|
||||
unread: sectionCategory.unread - action.section.unread,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue