mirror of
https://github.com/getbible/app.git
synced 2024-12-22 07:48:55 +00:00
Added new getters and debugged all getters, also added a loading var to state
This commit is contained in:
parent
2f84e963c8
commit
c71a1214fc
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
chapter : (state) =>{
|
||||
@ -7,7 +9,9 @@ export default {
|
||||
book_nr : (state) =>{
|
||||
return state.selected.book
|
||||
},
|
||||
|
||||
loading: (state) =>{
|
||||
return state.loading;
|
||||
},
|
||||
book_name:(state, getters)=> {
|
||||
return getters.books.find(book => book.nr === getters.book_nr).name
|
||||
},
|
||||
@ -17,29 +21,34 @@ export default {
|
||||
},
|
||||
|
||||
in_memory_translation : (state) =>{
|
||||
// console.log("from ", state.in_memory_translation );
|
||||
return state.in_memory_translation
|
||||
},
|
||||
|
||||
books : (state)=>{
|
||||
if(!state.in_memory_translation.books)
|
||||
books : (state, getters)=>{
|
||||
if(!getters.in_memory_translation.books)
|
||||
return []
|
||||
|
||||
return state.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}))
|
||||
},
|
||||
|
||||
dir:(state, getters)=>{
|
||||
if(getters.in_memory_translation.dir)
|
||||
return getters.in_memory_translation.dir.toLowerCase();
|
||||
// console.log(getters.in_memory_translation);
|
||||
if(!getters.in_memory_translation.direction)
|
||||
return 'ltr'
|
||||
return getters.in_memory_translation.direction.toLowerCase();
|
||||
},
|
||||
|
||||
chapters : (state, getters) =>{
|
||||
if(!getters.book) return [];
|
||||
const book = getters.books.find(book => book.nr === getters.book)
|
||||
console.log(getters.book_nr);
|
||||
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);
|
||||
return book.chapters
|
||||
},
|
||||
|
||||
verses: (state, getters) => {
|
||||
// console.log("Searching for chapter", getters.chapter);
|
||||
if(!getters.chapter)
|
||||
return []
|
||||
const chapter = getters.chapters.find(chapter => chapter.chapter === getters.chapter)
|
||||
|
@ -7,6 +7,7 @@ export default {
|
||||
book: null,
|
||||
chapter: null
|
||||
},
|
||||
loading: false,
|
||||
in_memory_translation:{},
|
||||
search: '',
|
||||
}
|
Loading…
Reference in New Issue
Block a user