mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 02:12:53 +00:00
changes
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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';
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user