0.2.3 #99

Merged
sonny merged 112 commits from development into master 2020-05-23 16:58:42 +02:00
3 changed files with 13 additions and 6 deletions
Showing only changes of commit 12693dac10 - Show all commits

View file

@ -27,6 +27,7 @@ export const postRead = (post, section) => ({
export const markPostRead = (post, token) => { export const markPostRead = (post, token) => {
return (dispatch, getState) => { return (dispatch, getState) => {
const { rules } = getState(); const { rules } = getState();
const { selected } = getState();
const url = `/api/posts/${post.id}/`; const url = `/api/posts/${post.id}/`;
const options = { const options = {
@ -38,10 +39,7 @@ export const markPostRead = (post, token) => {
body: JSON.stringify({ read: true }), body: JSON.stringify({ read: true }),
}; };
const section = { const section = { ...selected.item };
...rules.items[post.rule],
type: RULE_TYPE,
};
return fetch(url, options) return fetch(url, options)
.then(response => response.json()) .then(response => response.json())

View file

@ -46,7 +46,16 @@ export const categories = (state = { ...defaultState }, action) => {
isFetching: true, isFetching: true,
}; };
case MARK_POST_READ: case MARK_POST_READ:
let category = { ...state.items[action.section.category] }; let category = {};
switch (action.section.type) {
case CATEGORY_TYPE:
category = { ...state.items[action.section.id] };
break;
case RULE_TYPE:
category = { ...state.items[action.section.category] };
break;
}
return { return {
...state, ...state,

View file

@ -34,7 +34,7 @@ export const rules = (state = { ...defaultState }, action) => {
isFetching: false, isFetching: false,
}; };
case MARK_POST_READ: case MARK_POST_READ:
const rule = { ...state.items[action.section.id] }; const rule = { ...state.items[action.post.rule] };
return { return {
...state, ...state,