I'm trying to create a table that shows data from server. The deleting method works but it shows on the table only after refreshing the page. How can I force the component to re-render after deleting an item? this.$forceUpdate doesn't work.
This is the delete function:
async deleteProduct(id) {
const resp = await fetch(`http://localhost:3005/products/${id}`, {
method: "DELETE",
});
}
and that's the table:
<table border="1">
<tr>
<th>Product</th>
<th>Title</th>
<th>Price</th>
<th>Options</th>
</tr>
<tr v-for="product in products" :title="product.description">
<td><img :src="product.image" :alt="product.title"/></td>
<td>{{ product.title }}</td>
<td>{{ `${product.price}$` }}</td>
<td>
<button @click="toggleEdit(product._id)">edit</button>  
<button @click="deleteProduct(product._id)">delete</button>
</td>
</tr>
</table>