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 {
|
export default class ScriptureNavBarComponent extends Component {
|
||||||
@service router;
|
@service router;
|
||||||
|
@service store;
|
||||||
|
|
||||||
@tracked chaptersVisible = false;
|
@tracked chaptersVisible = false;
|
||||||
@tracked versesVisible = false;
|
@tracked versesVisible = false;
|
||||||
@tracked currentBook = null;
|
@tracked currentBook = null;
|
||||||
@tracked currentChapter = null;
|
@tracked currentChapter = null;
|
||||||
|
@tracked books = [];
|
||||||
|
|
||||||
constructor(...args) {
|
constructor(...args) {
|
||||||
super(...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
|
@action
|
||||||
|
|
Loading…
Reference in New Issue