|
@@ -1,30 +1,12 @@
|
|
|
-import { ClustersState, FetchStatus, Action } from 'types';
|
|
|
+import { ClustersState, Action } from 'types';
|
|
|
import actionType from 'redux/reducers/actionType';
|
|
|
|
|
|
-export const initialState: ClustersState = {
|
|
|
- fetchStatus: FetchStatus.notFetched,
|
|
|
- items: [],
|
|
|
-};
|
|
|
+export const initialState: ClustersState = [];
|
|
|
|
|
|
const reducer = (state = initialState, action: Action): ClustersState => {
|
|
|
switch (action.type) {
|
|
|
- case actionType.CLUSTERS__FETCH_REQUEST:
|
|
|
- return {
|
|
|
- ...state,
|
|
|
- fetchStatus: FetchStatus.fetching,
|
|
|
- };
|
|
|
- case actionType.CLUSTERS__FETCH_SUCCESS:
|
|
|
- return {
|
|
|
- ...state,
|
|
|
- fetchStatus: FetchStatus.fetched,
|
|
|
- items: action.payload,
|
|
|
- };
|
|
|
- case actionType.CLUSTERS__FETCH_FAILURE:
|
|
|
- return {
|
|
|
- ...state,
|
|
|
- fetchStatus: FetchStatus.errorFetching,
|
|
|
- };
|
|
|
-
|
|
|
+ case actionType.GET_CLUSTERS__SUCCESS:
|
|
|
+ return action.payload;
|
|
|
default:
|
|
|
return state;
|
|
|
}
|