Initial commit
This commit is contained in:
parent
40a0b72d87
commit
f9105b2661
2 changed files with 4 additions and 6 deletions
|
|
@ -6,7 +6,6 @@ import { fetchPostsBySection, fetchSavedPosts } from '../../actions/posts.js';
|
|||
import { SAVED_TYPE } from '../../constants.js';
|
||||
import { filterPosts } from './filters.js';
|
||||
|
||||
import LoadingIndicator from '../../../../components/LoadingIndicator.js';
|
||||
import PostItem from './PostItem.js';
|
||||
|
||||
class PostList extends React.Component {
|
||||
|
|
@ -56,8 +55,9 @@ class PostList extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const isLastItem = this.props.postsByType.length - 1 == index;
|
||||
|
||||
const postItems = this.props.postsByType.map((item, index) => {
|
||||
const isLastItem = this.props.postsByType.length - 1 == index;
|
||||
const defaultProps = {
|
||||
key: index,
|
||||
post: item,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import { isEqual } from 'lodash';
|
||||
|
||||
import { objectsFromArray } from '../../../utils.js';
|
||||
import { CATEGORY_TYPE, RULE_TYPE } from '../constants.js';
|
||||
|
||||
|
|
@ -12,8 +10,6 @@ import {
|
|||
TOGGLING_POST,
|
||||
TOGGLED_POST,
|
||||
} from '../actions/posts.js';
|
||||
import { SELECT_CATEGORY } from '../actions/categories.js';
|
||||
import { SELECT_RULE } from '../actions/rules.js';
|
||||
import { MARK_SECTION_READ } from '../actions/selected.js';
|
||||
|
||||
const defaultState = { items: {}, isFetching: false, isUpdating: false };
|
||||
|
|
@ -22,11 +18,13 @@ export const posts = (state = { ...defaultState }, action) => {
|
|||
switch (action.type) {
|
||||
case REQUEST_POSTS:
|
||||
return { ...state, isFetching: true };
|
||||
// TODO: save post per category/rule in corresponding reducers
|
||||
case RECEIVE_POST:
|
||||
return {
|
||||
...state,
|
||||
items: { ...state.items, [action.post.id]: { ...action.post } },
|
||||
};
|
||||
// TODO: save posts per category/rule in corresponding reducers
|
||||
case RECEIVE_POSTS:
|
||||
const receivedItems = objectsFromArray(action.posts, 'id');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue