0👍
In Poems.vue the url
should be /poems
and NOT http://localhost:8081/poems
.
Browser will use correct domain automatically. You need to put /
at the beginning to indicate that the path is absolute, and not relative to the current page.
Complete code:
fetchPoems(){
return axios({
method: 'get',
url: '/poems',
headers: {
'Content-Type': 'application/json',
},
})
.then((res)=>{
this.poems = res.data.poems;
})
.catch((err)=>{
console.log(err);
});
}
- [Vuejs]-V-if not updating in vue from radiobuttons toggling value
- [Vuejs]-Multiple requests with nuxt-axios
Source:stackexchange.com