Adding request now totally works

Also:
- added progress bar, integrated with journal loading
- updated Vue app dependencies
This commit is contained in:
Daniel J. Summers
2017-09-21 21:31:59 -05:00
parent f5a14fb66e
commit a6b5149b34
8 changed files with 135 additions and 64 deletions

View File

@@ -60,8 +60,9 @@ export default new Vuex.Store({
}
},
actions: {
async [actions.LOAD_JOURNAL] ({ commit }) {
async [actions.LOAD_JOURNAL] ({ commit }, progress) {
commit(mutations.LOADED_JOURNAL, {})
progress.start()
commit(mutations.LOADING_JOURNAL, true)
api.setBearer(localStorage.getItem('id_token'))
try {
@@ -71,12 +72,13 @@ export default new Vuex.Store({
logError(err)
} finally {
commit(mutations.LOADING_JOURNAL, false)
progress.finish()
}
},
async [actions.ADD_REQUEST] ({ commit }, requestText) {
try {
const newRequest = await api.addRequest(requestText)
commit(mutations.REQUEST_ADDED, newRequest)
commit(mutations.REQUEST_ADDED, newRequest.data)
} catch (err) {
logError(err)
}