const INITIAL_STATE = {
        description: 'Ler Livro',
        list:[{
            _id: 1,
            description: 'Pagar fatura',
            done: true
        },{
            _id: 2,
            description: 'Reunião com a equipe',
            done: false
        },{
            _id: 3,
            description: 'Consulta médica',
            done: false
            
        }]
    }

    export default (state = INITIAL_STATE, action) => {
        switch(action.type){
            case 'DESCRIPTION_CHANGED':
                return{ ...state, description: action.payload}
            case 'TODO_SEARCHED':
                return {...state, list: action.payload.data}
                case 'TODO_ADDED':
                return{...state, description: ''}
            default: 
                return state
        }
    }