1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 02:12:53 +00:00
This commit is contained in:
2016-08-30 02:45:56 +00:00
parent 7c350be5b7
commit 97598ba7e8
8 changed files with 29 additions and 16 deletions

View File

@@ -2,6 +2,12 @@ import * as types from "./constants";
import marked from 'marked';
import 'whatwg-fetch';
export function increasePostLimit(){
return {
type: types.INCREASE_POST_LIMIT
}
}
function initPreview(posts) {
return {
type: types.INIT_PREVIEW,

View File

@@ -2,4 +2,5 @@
export const INIT_PREVIEW = 'INIT_PREVIEW';
export const FILTER_PREVIEW = 'FILTER_PREVIEW';
export const LOAD_POST = 'LOAD_POST';
export const FETCHING = 'FETCHING';
export const FETCHING = 'FETCHING';
export const INCREASE_POST_LIMIT = 'INCREASE_POST_LIMIT';

View File

@@ -14,12 +14,10 @@ const defaultState = {
preview: {
posts: []
},
filteredPreview: {
posts: []
},
post: "",
fetched: false,
fetching: false
fetching: false,
postLimit: 10
};
//default reducer
@@ -32,10 +30,6 @@ function reducer(state = defaultState, action) {
fetched: true,
fetching: false
});
case types.FILTER_PREVIEW:
return Object.assign({}, state, {
filteredPreview: Object.assign({}, state.filteredPreview, action.posts)
});
case types.LOAD_POST:
return Object.assign({}, state, {
post: action.post,
@@ -47,6 +41,10 @@ function reducer(state = defaultState, action) {
fetched : false,
fetching: true
});
case types.INCREASE_POST_LIMIT:
return Object.assign({}, state, {
postLimit : state.postLimit + 10
});
}
//return present state if no actions get called