mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-13 11:12:47 +00:00
fixed end point - fixed posts in metadata
This commit is contained in:
@@ -6,19 +6,23 @@ const defaultState = {
|
||||
list : [],
|
||||
infoMonth: [],
|
||||
infoYear: [],
|
||||
uniqueDates: {},
|
||||
|
||||
fetchingList: false,
|
||||
fetchingInfoMonth: false,
|
||||
fetchingInfoYear: false,
|
||||
fetchingUniqueDates: false,
|
||||
|
||||
fetchedList: false,
|
||||
fetchedInfoMonth: false,
|
||||
fetchedInfoYear: false
|
||||
fetchedInfoYear: false,
|
||||
fetchedUniqueDates: false
|
||||
};
|
||||
|
||||
//default reducer
|
||||
export default function app(state = defaultState, action) {
|
||||
switch(action.type){
|
||||
//fetching functions - we use a fetching state to display loading images
|
||||
case types.FETCHING_LIST:
|
||||
return Object.assign({}, state, {
|
||||
fetchingList: true,
|
||||
@@ -34,7 +38,13 @@ export default function app(state = defaultState, action) {
|
||||
fetchingInfoYear: true,
|
||||
fetchedInfoYear: false
|
||||
});
|
||||
case types:FETCHING_UNIQUE_DATES:
|
||||
return Object.assign({}, state, {
|
||||
fetchingUniqueDates: true,
|
||||
fetchedUniqueDates: false
|
||||
});
|
||||
|
||||
//other functions
|
||||
case types.LOAD_SENSOR_LIST:
|
||||
return Object.assign({}, state, {
|
||||
list: action.sensor_list,
|
||||
@@ -53,6 +63,12 @@ export default function app(state = defaultState, action) {
|
||||
fetchingInfoYear: false,
|
||||
fetchedInfoYear: true
|
||||
});
|
||||
case types.LOAD_UNIQUE_DATES:
|
||||
return Object.assign({}, state, {
|
||||
uniqueDates: action.dates,
|
||||
fetchingUniqueDates: false,
|
||||
fetchedUniqueDates: true
|
||||
});
|
||||
}
|
||||
//return present state if no actions get called
|
||||
return state;
|
||||
|
||||
Reference in New Issue
Block a user