Project

General

Profile

Download (613 Bytes) Statistics
| Branch: | Tag: | Revision:
import {
HOST_POWER_STATUS_REQUEST,
HOST_POWER_STATUS_SUCCESS,
HOST_POWER_STATUS_FAILURE
} from '../../../consts';
import Immutable from 'seamless-immutable';

const initialState = Immutable({});

export default (state = initialState, action) => {
const { payload } = action;

switch (action.type) {
case HOST_POWER_STATUS_REQUEST:
case HOST_POWER_STATUS_SUCCESS:
return state.set(
payload.id,
payload
);
case HOST_POWER_STATUS_FAILURE:
return state.set(
payload.id,
{ error: payload.error }
);
default:
return state;
}
};
(1-1/3)