4
2
mirror of https://github.com/getbible/app.git synced 2024-12-22 07:48:55 +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 { export default {
@ -13,13 +13,18 @@ export default {
return state.loading; return state.loading;
}, },
book_name:(state, getters)=> { 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)=>{ translation: (state)=>{
return state.selected.translation; return state.selected.translation;
}, },
saved_translations: (state)=>{
return state.saved_translations;
},
in_memory_translation : (state) =>{ in_memory_translation : (state) =>{
// console.log("from ", state.in_memory_translation ); // console.log("from ", state.in_memory_translation );
return state.in_memory_translation return state.in_memory_translation
@ -28,7 +33,7 @@ export default {
books : (state, getters)=>{ books : (state, getters)=>{
if(!getters.in_memory_translation.books) if(!getters.in_memory_translation.books)
return [] return []
debugger;
return getters.in_memory_translation.books.map(book => ({nr: book.nr, name: book.name})) return getters.in_memory_translation.books.map(book => ({nr: book.nr, name: book.name}))
}, },
@ -38,9 +43,14 @@ export default {
return 'ltr' return 'ltr'
return getters.in_memory_translation.direction.toLowerCase(); return getters.in_memory_translation.direction.toLowerCase();
}, },
search: (state)=>{
console.log(state.search);
debugger;
return state.search;
},
chapters : (state, getters) =>{ chapters : (state, getters) =>{
console.log(getters.book_nr); console.log(getters.book_nr);
debugger;
if(!getters.book_nr) return []; if(!getters.book_nr) return [];
const book = getters.in_memory_translation.books.find(book => book.nr == getters.book_nr) const book = getters.in_memory_translation.books.find(book => book.nr == getters.book_nr)
console.log("Found the book",book); console.log("Found the book",book);