Commit c7d2068c authored by Phuengton Chummuel's avatar Phuengton Chummuel

change action in reminderAction.js

parent 72092594
......@@ -8,20 +8,21 @@ import realm from './../Database/'
import moment from 'moment'
import { ToastAndroid } from 'react-native'
export const reminderCreate = ({ id, doctorName, date, place, time }) => {
export const reminderCreate = ({ id, medName, reminderTime, meal, period, dose }) => {
return (dispatch) => {
let appointment = { id, doctorName, date, place, time }
realm.write(() => {
realm.create('Reminder', {
id: id,
doctorName: doctorName,
date: date,
place: place,
medName: medName,
reminderTime: reminderTime,
meal: meal,
period: period,
dose: dose,
timeStamp: moment().toDate()
})
})
let appointments = realm.objects("Reminder")
dispatch({ type: APPOINTMENT_CREATE, payload: appointments })
let reminders = realm.objects("Reminder")
dispatch({ type: REMINDER_CREATE, payload: reminders })
}
}
......@@ -33,8 +34,8 @@ export const reminderUpdate = () => {
export const reminderFetch = () => {
return (dispatch) => {
let appointments = realm.objects("Reminder")
dispatch({ type: APPOINTMENT_FETCH, payload: appointments })
let reminders = realm.objects("Reminder")
dispatch({ type: REMINDER_FETCH, payload: reminders })
}
}
......@@ -44,7 +45,7 @@ export const reminderDelete = (id) => {
realm.write(() => {
realm.delete(item)
})
let appointments = realm.objects("Reminder")
dispatch({ type: APPOINTMENT_DELETE, payload: appointments })
let reminders = realm.objects("Reminder")
dispatch({ type: REMINDER_DELETE, payload: reminders })
}
}
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