Editing request works

A "mark prayed" update uses the same fields, so we only have one "update
request" action now
This commit is contained in:
Daniel J. Summers
2017-09-22 23:30:23 -05:00
parent 181dc5ea63
commit 396e53b1a6
6 changed files with 93 additions and 20 deletions

View File

@@ -5,6 +5,6 @@ export default {
ADD_REQUEST: 'add-request',
/** Action to load the user's prayer journal */
LOAD_JOURNAL: 'load-journal',
/** Action to mark a request as prayed */
MARK_PRAYED: 'mark-prayed'
/** Action to update a request */
UPDATE_REQUEST: 'update-request'
}

View File

@@ -92,11 +92,11 @@ export default new Vuex.Store({
commit(mutations.LOADING_JOURNAL, false)
}
},
async [actions.MARK_PRAYED] ({ commit }, { progress, requestId }) {
async [actions.UPDATE_REQUEST] ({ commit }, { progress, requestId, status, updateText }) {
progress.start()
try {
progress.start()
await api.markPrayed(requestId)
const request = await api.getPrayerRequest(requestId)
await api.updateRequest({ requestId, status, updateText })
const request = await api.getRequest(requestId)
commit(mutations.REQUEST_UPDATED, request.data)
progress.finish()
} catch (err) {