{"size": 2161, "ext": "js", "max_stars_repo_path": "resources/js/stores/reducers/services_reducer.js", "max_stars_repo_name": "antoinebelmont/sayjr-web", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "resources/js/stores/reducers/services_reducer.js", "max_issues_repo_name": "antoinebelmont/sayjr-web", "max_issues_repo_issues_event_min_datetime": "2020-03-26T19:54:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-18T12:11:40.000Z", "max_forks_repo_path": "resources/js/stores/reducers/services_reducer.js", "max_forks_repo_name": "antoinebelmont/sayjr-web", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 9, "max_forks_count": null, "avg_line_length": 25.7261904762, "max_line_length": 62, "alphanum_fraction": 0.5525219806}
import {
    SERVICE_CATALOGS,
    UPDATE_ACCOUNT_COVERAGES,
    CREATE_SERVICE,
    SERVICE_LIST,
    GET_SERVICE,
    GET_SERVICE_DETAIL,
    CREATE_COMMENT,
    GET_SERVICE_COMMENTS,
    CREATE_PAYMENT,
    GET_SERVICE_PAYMENTS,
    GET_TRACKING,
    CREATE_INVOICE,
    GET_REPORT
} from "../types";

const serviceState = {
    catalogs: [],
    services: [],
    comments:[],
    payments:[],
    report:[]
};

export default (state = serviceState, action) => {
    let _state = state;
    switch (action.type) {
        case GET_TRACKING:{
            _state.tracking = action.payload.tracking;
            return _state;
        }
        case SERVICE_CATALOGS: {
            _state.catalogs = action.payload.catalogs;
            return _state;
        }
        case SERVICE_LIST: {
            _state.catalogs = action.payload.services;
            return _state;
        }
        case UPDATE_ACCOUNT_COVERAGES: {
            _state.services = action.payload.accountCoverages;
            return _state;
        }
        case CREATE_SERVICE: {
            _state.catalogs = action.payload.serviceId;
            return _state;
        }
        case CREATE_INVOICE: {
            _state.invoice = action.payload.invoice;
            return _state;
        }
        case CREATE_COMMENT: {
            _state.comments = action.payload.comments;
            return _state;
        }
        case CREATE_PAYMENT: {
            _state.payments = action.payload.payments;
            return _state;
        }
        case GET_SERVICE: {
            _state.report = action.payload;
            return _state;
        }
        case GET_REPORT: {
            _state.service = action.payload;
            return _state;
        }
        case GET_SERVICE_DETAIL: {
            _state.service = action.payload;
            return _state;
        }
        case GET_SERVICE_COMMENTS: {
            _state.comments = action.payload.comments;
            return _state;
        }
        case GET_SERVICE_PAYMENTS: {
            _state.payments = action.payload.payments;
            return _state;
        }
        default:
            return state;
    }
};
