<div v-for="article in articles" :key="article.id">
<button @click="deleteArticle(article.id)">Delete</button>
</div>
methods: {
deleteArticle(id){
fetch(`api/articles/${id}`,{
method: 'DELETE'
})
.then(res => res.json())
.then(data =>{
alert('article deleted');
this.fetchArticles(); // to get the updated resouces after deletion
})
.catch(err => console.log(err));
}
}