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//Install Axios from terminal
2npm install axios
3//Import Axios in your HelloWorld.vue
4import axios from 'axios'
5//Add a method to implement Axios
6test () {
7 axios.post('URL')
8 .then(function (response) {
9 alert (response.data);
10 })
11 .catch(function (error) {
12 alert(error);
13 });
14 }
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