nomanHasan
10/11/2017 - 10:03 AM

8 #todoapp-angular-ngrx

8 #todoapp-angular-ngrx

// ........................

export function TodoReducer(state = defaultState, action: Action) {

    switch (action.type) {
    
      
      //...............
      
      case TodoActions.COMPLETE_TODO: {


            return {
                ...state,
                todos: state.todos.map(t => {
                    if (t._id == action.payload._id) {
                        t.status = "done";
                    }

                    return t
                })
            };

        }
        
        default: {

            return state;
        }
        
    
    
    }
    
}