signoz/frontend/src/store/reducers/serviceMap.ts
2022-04-01 17:59:44 +05:30

34 lines
620 B
TypeScript

import { Action, ActionTypes, ServiceMapStore } from 'store/actions';
const initialState: ServiceMapStore = {
items: [],
services: [],
loading: true,
};
export const ServiceMapReducer = (
state = initialState,
action: Action,
): ServiceMapStore => {
switch (action.type) {
case ActionTypes.getServiceMapItems:
return {
...state,
items: action.payload,
};
case ActionTypes.getServices:
return {
...state,
services: action.payload,
};
case ActionTypes.serviceMapLoading: {
return {
...state,
loading: action.payload.loading,
};
}
default:
return state;
}
};