1async created() {
2 // GET request using fetch with async/await
3 const response = await fetch("https://api.npms.io/v2/search?q=vue");
4 const data = await response.json();
5 this.totalVuePackages = data.total;
6}
1# http requests using Fetcht api in Vue 3 explained (see videos below)
2https://www.youtube.com/watch?v=-Aoyja_BjZY
3https://www.youtube.com/watch?v=LvOYCjpMQ10
1async fetch({ store, $axios, error }) {
2 const {data} = await $axios.get('/posts');
3 store.dispatch('setPosts', data)
4 }