github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/build-blockchain-insurance-app-master/web/src/repair-shop/reducers/repairShopReducer.js (about) 1 'use strict'; 2 3 import * as RepairShopActionType from '../actions/repairShopActionTypes'; 4 import * as initialState from './initialState'; 5 6 export default function repairShopReducer(state = initialState.repairShop, action) { 7 switch (action.type) { 8 case RepairShopActionType.LOAD_REPAIR_ORDERS_SUCCESS: 9 return Object.assign({}, state, { repairOrders: action.repairOrders }); 10 case RepairShopActionType.COMPLETE_REPAIR_ORDER_SUCCESS: 11 return Object.assign({}, state, 12 { 13 repairOrders: [ 14 ...(state.repairOrders.filter(ro => ro.uuid !== action.uuid)) 15 ] 16 }); 17 default: 18 return state; 19 } 20 }