{"size": 2918, "ext": "js", "max_stars_repo_path": "src/redux/reducers/clientReducer.js", "max_stars_repo_name": "CoachMe-Lambda-LabsPT10/coach-me-fe", "max_stars_repo_stars_event_min_datetime": "2020-10-01T19:29:38.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-01T19:29:38.000Z", "max_issues_repo_path": "src/redux/reducers/clientReducer.js", "max_issues_repo_name": "CoachMe-Lambda-LabsPT10/coach-me-fe", "max_issues_repo_issues_event_min_datetime": "2020-05-06T02:09:02.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-16T23:15:57.000Z", "max_forks_repo_path": "src/redux/reducers/clientReducer.js", "max_forks_repo_name": "CoachMe-Lambda-LabsPT10/coach-me-fe", "max_forks_repo_forks_event_min_datetime": "2020-10-07T02:26:32.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-29T22:10:22.000Z"}
{"max_stars_count": 1, "max_issues_count": 2, "max_forks_count": 2, "avg_line_length": 24.3166666667, "max_line_length": 50, "alphanum_fraction": 0.4924605894}
import {
    LOGIN_SUCCESS,
    LOGIN_FAIL,
    LOGIN_START,
    UPDATE_METRIC_START,
    UPDATE_METRIC_SUCCESS,
    UPDATE_METRIC_FAILURE,
    GET_CLIENTS_SUCCESS,
    GET_METRICS_START,
    GET_METRICS_SUCCESS,
    GET_METRICS_FAILURE,
    GET_UPCOMING_SESSIONS,
    GET_CLIENTS_FAILURE,
    EMAIL_REQUEST_SUCCESS,
    EMAIL_REQUEST_FAILURE,
    PASSWORD_RESET_SUCCESS,
    PASSWORD_RESET_FAILURE,
    GET_CLIENT_INFO,
    CLIENT_REGISTER_SUCCESS,
    CLIENT_LOGIN_SUCCESS,
    GET_MY_COACH,
    GET_CLIENT_GOALS,
} from '../actions/types';

const initialState = {
    message: '',
    LoginAttempts: 0,
    clientinfo: {},
    records: null,
    Blood_sugar: 0,
    Weight: 0,
    Blood_pressure_over: 0,
    Blood_pressure_under: 0,
    Date_time: null,
    isfetching: false,
    error: '',
    client_data: {
        coach: {
            calendly_url: '',
        },
    },
    loggedIn: false,
    clientMetrics: [],
    myCoach: {},
    upcomingSessions: [],
    myGoals : []
		
};

export default (state = initialState, action) => {
    switch (action.type) {
        case CLIENT_REGISTER_SUCCESS:
            return {
                ...state,
                loggedIn: false,
                client_data: action.payload,
            };
        case CLIENT_LOGIN_SUCCESS:
            return {
                ...state,
                loggedIn: true,
                client_data: action.payload,
                error: '',
            };
        case EMAIL_REQUEST_SUCCESS:
            return {
                ...state,
                isfetching: false,
                email: action.payload,
            };
        case EMAIL_REQUEST_FAILURE:
            return {
                ...state,
                isfetching: false,
                error: action.payload,
            };
        case PASSWORD_RESET_SUCCESS:
            return {
                ...state,
                isfetching: false,
                password: action.payload,
            };
        case PASSWORD_RESET_FAILURE:
            return {
                ...state,
                isfetching: false,
                error: action.payload,
            };
        case GET_CLIENT_INFO:
            return {
                ...state,
                loggedIn: true,
                client_data: action.payload,
            };
        case GET_CLIENTS_FAILURE:
            return {
                ...state,
                isfetching: false,
                error: action.payload,
            };
        case GET_MY_COACH:
            return {
                ...state,
                myCoach: action.payload,
						};
				case GET_UPCOMING_SESSIONS:
						return {
							...state,
							upcomingSessions: action.payload
                        }
        case GET_CLIENT_GOALS:
            return {
                ...state,
                myGoals: action.payload
            }
        default:
            return state;
    }
};
