I'm littlebit confused about the fetch function, this is my code:
<template>
<!-- above the fold -->
<section class="uk-section uk-section-primary">
<div class="uk-container">
{{ items }}
</div>
</section>
<!-- end above the fold -->
</template>
<script>
// @ is an alias to /src
export default {
name: 'Home',
data() {
return {
items: {}
}
},
mounted() {
this.getInfo()
},
methods: {
getInfo() {
fetch('mydomain.net/cockpit/api/singletons/get/frontpage' , {
headers: { 'Authorization': 'Bearer xxmySecretxx' }
})
.then(res => this.items = res.json())
.then(res => console.log(res));
}
},
}
</script>
In console.log I can view the items value, but on the browser the result is [object Promise] how fetch() works?