in src/app/customers/store/customers.reducer.ts [32:74]
export function reducer(state = initialState, action: customer.Actions | customerTasks.Actions): ResourceState {
switch (action.type) {
case customerTasks.EXECUTE_COMMAND_SUCCESS: {
const payload = action.payload;
const customerId = payload.customerId;
const command: Command = payload.command;
const customer = state.entities[customerId];
let customerState: CustomerState = null;
if (command.action === 'ACTIVATE') {
customerState = 'ACTIVE';
}else if (command.action === 'LOCK') {
customerState = 'LOCKED';
}else if (command.action === 'UNLOCK') {
customerState = 'ACTIVE';
}else if (command.action === 'CLOSE') {
customerState = 'CLOSED';
}else if (command.action === 'REOPEN') {
customerState = 'ACTIVE';
}
customer.currentState = customerState;
return {
ids: [ ...state.ids ],
entities: Object.assign({}, state.entities, {
[customer.identifier]: customer
}),
loadedAt: state.loadedAt,
selectedId: state.selectedId
};
}
default: {
return state;
}
}
}