{"size": 469, "ext": "js", "max_stars_repo_path": "Modulo 16/A18-Redirecionando para Conversas CC/src/reducers/ChatReducer.js", "max_stars_repo_name": "ederpbj/Devsapp", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Modulo 16/A18-Redirecionando para Conversas CC/src/reducers/ChatReducer.js", "max_issues_repo_name": "ederpbj/Devsapp", "max_issues_repo_issues_event_min_datetime": "2020-07-17T10:46:31.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-09T09:18:04.000Z", "max_forks_repo_path": "Modulo 16/A18-Redirecionando para Conversas CC/src/reducers/ChatReducer.js", "max_forks_repo_name": "ederpbj/Devsapp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 4, "max_forks_count": null, "avg_line_length": 20.3913043478, "max_line_length": 60, "alphanum_fraction": 0.5820895522}
const initialState ={
    chats:[],
    contacts:[],
    activeChat:''
};

const ChatReducer = (state = initialState, action) => {
    
    if(action.type == 'setContactList'){
        //alert('Retorno: '+action.payload.status);
        return {...state, contacts:action.payload.users};
    }
    
    if(action.type == 'setActiveChat'){
        return {...state, activeChat:action.payload.chatid};
    }
    
    return state;
    
    
};

export default ChatReducer;