I have tried suggestions such as:
Print response from http GET request using axios in vue.js?
Vue.js + Axios not assigning response Get response data from axios in vue.js
simple typescript function with axios get call does not work
None have solved the issue.
This is the code that I have (port 2020, doesn't work with 8080 either):
<template>
<p>{{ testResponse }}</p>
<button v-on:click="sendRequest">Get Data</button>
</template>
<script>
const axios = require("axios");
export default {
name: 'Auth',
created: function () {
},
data: function () {
return {
testResponse:'init',
};
},
beforeMount() {},
methods: {
sendRequest() {
this.getEvents("https://www.google.com");
},
async getEvents(url) {
axios
.get(url)
.then(response => {this.testResponse = response.data})
},
}
};
</script>
</template>
Pressing the button does not do anything. The GET does get sent, servers process the GET, but no data is obtained from it... What am I doing wrong ?
Edit: removed the junk.