{"size": 681, "ext": "js", "max_stars_repo_path": "src/_reducers/Books.reducer.js", "max_stars_repo_name": "lazydevbutler/An-API-of-Fire-and-Ice", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/_reducers/Books.reducer.js", "max_issues_repo_name": "lazydevbutler/An-API-of-Fire-and-Ice", "max_issues_repo_issues_event_min_datetime": "2021-05-11T11:07:21.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-11T11:07:21.000Z", "max_forks_repo_path": "src/_reducers/Books.reducer.js", "max_forks_repo_name": "RaphaelChua/An-API-of-Fire-and-Ice", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 30.9545454545, "max_line_length": 92, "alphanum_fraction": 0.6519823789}
import { booksConstant } from '../_constants'

const initialState = {
    bookCharacters:[],
    loading:false,
    error:''
};

const booksReducer = (state = initialState,action)=>{
    switch(action.type){
        case booksConstant.GET_LIST_REQUEST:
            return{ ...state, bookCharacters:[],loading:true, error:'' }
        case booksConstant.GET_LIST_SUCCESS:
            return{...state, bookCharacters: action.bookCharacters, error:'',loading:false}
        case booksConstant.GET_LIST_FAILURE:
            return {...state,bookCharacters:[],loading:false,error:'Retrieving List Failed'}
        default:
            return state;
    }

}
export default booksReducer;