Use es6 flavorz in timeRange reducer

pull/10616/head
Andrew Watkins 2017-02-13 16:33:59 -06:00
parent d1252cf90b
commit f1f7bb3720
1 changed files with 5 additions and 6 deletions

View File

@ -1,5 +1,3 @@
import update from 'react-addons-update';
const initialState = {
upper: null,
lower: 'now() - 15m',
@ -9,11 +7,12 @@ export default function timeRange(state = initialState, action) {
switch (action.type) {
case 'SET_TIME_RANGE': {
const {upper, lower} = action.payload;
const newState = {
upper,
lower,
};
return update(state, {
['lower']: {$set: lower},
['upper']: {$set: upper},
});
return {...state, ...newState};
}
}
return state;