1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 18:32:50 +00:00

redux functionality for sensor page

This commit is contained in:
2016-09-14 20:44:04 +00:00
parent 2f45864fcc
commit e03b3eae25
4 changed files with 75 additions and 20 deletions

View File

@@ -8,6 +8,9 @@ const defaultState = {
infoYear: [],
uniqueDates: {},
selectedYearIndex: 0,
selectedMonthIndex: 0,
fetchingList: false,
fetchingInfoMonth: false,
fetchingInfoYear: false,
@@ -69,6 +72,16 @@ export default function app(state = defaultState, action) {
fetchingUniqueDates: false,
fetchedUniqueDates: true
});
//indexes
case types.SET_SELECTED_YEAR_INDEX:
return Object.assign({}, state, {
selectedYearIndex: action.index
});
case types.SET_SELECTED_MONTH_INDEX:
return Object.assign({}, state, {
selectedMonthIndex: action.index
});
}
//return present state if no actions get called
return state;