Use es6 flavorz in timeRange reducer
parent
d1252cf90b
commit
f1f7bb3720
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue