Commit 8225be47 authored by Phuengton Chummuel's avatar Phuengton Chummuel

add redux reducers

parent fd0d4343
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
}
}
import { combineReducers } from 'redux'
import appointmentReducer from './appointmentReducer'
import reminderReducer from './reminderReducer'
export default combineReducers({
libraries: () => []
appointments: appointmentReducer,
reminders: reminderReducer
});
\ No newline at end of file
import {
REMINDER_FETCH,
REMINDER_CREATE,
REMINDER_UPDATE,
REMINDER_DELETE,
} from './../actions/types'
import { ToastAndroid } from 'react-native';
const INITIAL_STATE = { reminders: [] }
export default (state = INITIAL_STATE, action) => {
switch (action.type) {
case REMINDER_CREATE:
state = Object.assign([], state, { reminders: action.payload })
return state;
case REMINDER_FETCH:
state = Object.assign([], state, { reminders: action.payload });
return state;
case REMINDER_UPDATE:
state = Object.assign([], state, { reminders: action.payload });
return state;
case REMINDER_DELETE:
state = Object.assign([], state, { reminders: action.payload });
return state;
default:
return state
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment