diff --git a/src/components/Options.vue b/src/components/Options.vue index e8af860..08ad746 100644 --- a/src/components/Options.vue +++ b/src/components/Options.vue @@ -8,10 +8,10 @@ @@ -47,8 +47,8 @@ @@ -65,7 +65,7 @@ export default { data: function(){ return { translation: 'akjv', - translations: {}, + // translations: {}, chapter: 1, chapter_num: 1, chapters:{}, @@ -78,6 +78,10 @@ export default { message: 'Loading...' }}, computed: { + translations(){ + return this.$store.state.settings.savedTr; + }, + fchapters: function (){ if(!this.search) return this.chapter.verses @@ -92,7 +96,10 @@ export default { }, }, methods:{ - update_chapter() { + t(i){ + return this.translations.find(t => t.abbreviation === i) + }, + async update_chapter() { // this.loading = true this.progress = 95 let config = { @@ -101,7 +108,7 @@ export default { let url = `https://getbible.net/v2/${this.translation}/${this.book}/${this.chapter_num}.json` - let response = fetch(url, config).catch(function(err) { + let response = await fetch(url, config).catch(function(err) { this.chapter = err this.loading =false this.message = 'Error' @@ -111,7 +118,7 @@ export default { if (!response) return; this.progress = 99 - let data = response.json().catch(err => { + let data = await response.json().catch(err => { this.chapter = err this.loading =false this.message = 'Error' @@ -171,11 +178,11 @@ export default { let config = { headers: {'Access-Control-Allow-Origin': '*'} }; - fetch(`https://getbible.net/v2/translations.json`,config) - .then(response => response.json()) - .then(data => { - // console.log(data) - this.translations = data + // fetch(`https://getbible.net/v2/translations.json`,config) + // .then(response => response.json()) + // .then(data => { + // // console.log(data) + // this.translations = data fetch(`https://getbible.net/v2/${this.translation}/books.json`, config) .then(response => response.json()) @@ -187,18 +194,18 @@ export default { }).catch(function(err) { this.chapter = err }); - }).catch(function(err) { - this.chapter = err - }); + // }).catch(function(err) { + // this.chapter = err + // }); - fetch(`https://getbible.net/v2/kjv/${this.book}/${this.chapter_num}.json`,config) - .then(response => response.json()) - .then(data => { - console.log(data) - this.chapter = data - }).catch(function(err) { - this.chapter = err - }); + // fetch(`https://getbible.net/v2/kjv/${this.book}/${this.chapter_num}.json`,config) + // .then(response => response.json()) + // .then(data => { + // console.log(data) + // this.chapter = data + // }).catch(function(err) { + // this.chapter = err + // }); } } \ No newline at end of file