1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/store/feature-metrics-store.js

22 lines
590 B
JavaScript
Raw Normal View History

2016-11-10 14:26:24 +01:00
import { Map as $Map, fromJS } from 'immutable';
import {
RECEIVE_FEATURE_METRICS,
} from './feature-metrics-actions';
const metrics = (state = fromJS({ lastHour: {}, lastMinute: {} }), action) => {
switch (action.type) {
case RECEIVE_FEATURE_METRICS:
return state.withMutations((ctx) => {
ctx.set('lastHour', new $Map(action.metrics.lastHour));
ctx.set('lastMinute', new $Map(action.metrics.lastMinute));
return ctx;
});
default:
return state;
}
};
export default metrics;