forked from WycliffeAssociates/en_btr_frontend
Attempt to load only avaialable books
This commit is contained in:
parent
a98f0363cf
commit
14ade53db5
|
@ -6,15 +6,41 @@ import { inject as service } from '@ember/service';
|
|||
|
||||
export default class ScriptureNavBarComponent extends Component {
|
||||
@service router;
|
||||
@service store;
|
||||
|
||||
@tracked chaptersVisible = false;
|
||||
@tracked versesVisible = false;
|
||||
@tracked currentBook = null;
|
||||
@tracked currentChapter = null;
|
||||
@tracked books = [];
|
||||
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
this.books = books;
|
||||
console.log(books);
|
||||
this.books = this.availableBooks;
|
||||
// console.log(this.books);
|
||||
}
|
||||
|
||||
// get only the books that we have backend data for
|
||||
get
|
||||
availableBooks()
|
||||
{
|
||||
return this.store.findAll('book').then(function(backendBooks) {
|
||||
let available = [];
|
||||
backendBooks.forEach(
|
||||
value => {
|
||||
let foundValue = books.find(function(book) {
|
||||
return book['name'] == value.id
|
||||
});
|
||||
if(foundValue) {
|
||||
available.push(foundValue);
|
||||
}
|
||||
});
|
||||
return available;
|
||||
}).then(function(response) {
|
||||
console.log(response);
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
Loading…
Reference in New Issue