import {
    APPOINTMENT_FETCH,
    APPOINTMENT_CREATE,
    APPOINTMENT_UPDATE,
    APPOINTMENT_DELETE,
} from './../actions/types'
import { Alert } from 'react-native'
import { ToastAndroid } from 'react-native';

const INITIAL_STATE = { appointments: [] }

export default (state = INITIAL_STATE, action) => {
    switch (action.type) {

        case APPOINTMENT_CREATE:
            state = Object.assign([], state, { appointments: action.payload })
            return state;

        case APPOINTMENT_FETCH:
            state = Object.assign([], state, { appointments: action.payload });
            return state;

        case APPOINTMENT_UPDATE:
            state = Object.assign([], state, { appointments: action.payload });
            return state;

        case APPOINTMENT_DELETE:
            state = Object.assign([], state, { appointments: action.payload });
            return state;

        default:
            return state
    }
}
