4
2
mirror of https://github.com/getbible/app.git synced 2024-12-22 15:58:55 +00:00

Adding actions and mutations to mutate the selected chapter, book as well as translations state properties

This commit is contained in:
Erastus Amunwe 2020-11-02 14:42:16 +02:00
parent 5a4a3e9832
commit 17a111d2dd
2 changed files with 5 additions and 2 deletions

View File

@ -90,7 +90,7 @@ export default {
commit('set_book', payload) commit('set_book', payload)
}, },
async set_translation({commit}, payload){ async set_translation({commit}, payload){
let translation = await idb.get('translations', payload.selectedTranslation).catch(err => console.log(err)); let translation = await idb.get('translations', payload.selected_translation).catch(err => console.log(err));
if(!translation) return; if(!translation) return;
payload.translation = translation payload.translation = translation

View File

@ -59,10 +59,13 @@ export default {
state.selected.chapter = payload; state.selected.chapter = payload;
}, },
set_book(state, payload){ set_book(state, payload){
state.selected.chapter = null;
state.selected.book = payload; state.selected.book = payload;
}, },
set_translation(state, payload){ set_translation(state, payload){
state.selected.translation = payload.selectedTranslation; state.selected.book = null
state.selected.chapter = null
state.selected.translation = payload.selected_translation;
state.in_memory_translation = payload.translation; state.in_memory_translation = payload.translation;
} }
} }