symphony-integration-commons
Version:
Common components for 3rd party developers build the user facing application for Symphony Integrations.
37 lines (34 loc) • 833 B
JavaScript
import {
FETCH_INSTANCE_LIST_SUCCESS,
SUCCESSFULLY_CREATED,
SUBMIT_DONE,
} from '../actions';
const instanceList = (state = { instances: [], loading: true, firstScreen: true }, action) => {
switch (action.type) {
case FETCH_INSTANCE_LIST_SUCCESS:
return Object.assign({}, state, {
...state,
instances: action.payload,
loading: false,
});
case SUCCESSFULLY_CREATED:
return Object.assign({}, state, {
...state,
loading: false,
instances: [
...state.instances,
action.instance,
],
firstScreen: false,
});
case SUBMIT_DONE:
return Object.assign({}, state, {
...state,
loading: true,
instances: [],
});
default:
return state;
}
};
export default instanceList;