4
2
mirror of https://github.com/getbible/app.git synced 2024-12-22 07:48:55 +00:00

created hook to get the available translations

This commit is contained in:
Erastus Amunwe 2020-10-26 16:50:45 +02:00
parent 1a8c3add7a
commit 3c222f8261

View File

@ -14,4 +14,33 @@
</div>
</nav>
</template>
</template>
<script>
export default {
data: () => {
return {
translations: {},
}
},
async created(){
let config = {
headers: {'Access-Control-Allow-Origin': '*'}
};
let response =fetch(`https://getbible.net/v2/translations.json`,config)
.catch(function(err) { this.translations = err });
if(!response)
return;
let data = response.json().catch(err => {console.log(err);})
if(!data)
return;
this.translations = data
}
}
</script>