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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user