4
2
mirror of https://github.com/getbible/app.git synced 2024-12-21 23:48:53 +00:00

debugged getters

This commit is contained in:
Erastus Amunwe 2020-12-04 13:34:44 +02:00
parent 1c6a99b026
commit 466f9a8489

View File

@ -1,4 +1,4 @@
/* eslint-disable no-debugger */
export default {
@ -13,13 +13,18 @@ export default {
return state.loading;
},
book_name:(state, getters)=> {
return getters.books.find(book => book.nr === getters.book_nr).name
if(!getters.books.length) return null
let book = getters.books.find(book => book.nr === getters.book_nr)
if(!book) return null;
return book.name;
},
translation: (state)=>{
return state.selected.translation;
},
saved_translations: (state)=>{
return state.saved_translations;
},
in_memory_translation : (state) =>{
// console.log("from ", state.in_memory_translation );
return state.in_memory_translation
@ -28,7 +33,7 @@ export default {
books : (state, getters)=>{
if(!getters.in_memory_translation.books)
return []
debugger;
return getters.in_memory_translation.books.map(book => ({nr: book.nr, name: book.name}))
},
@ -38,9 +43,14 @@ export default {
return 'ltr'
return getters.in_memory_translation.direction.toLowerCase();
},
search: (state)=>{
console.log(state.search);
debugger;
return state.search;
},
chapters : (state, getters) =>{
console.log(getters.book_nr);
debugger;
if(!getters.book_nr) return [];
const book = getters.in_memory_translation.books.find(book => book.nr == getters.book_nr)
console.log("Found the book",book);