1👍
✅
ASYNC/AWAIT FIX:
async getOrders(ctx, data) {
try {
const { data } = await axios({
url: '/orders',
data: data,
method: 'GET'
})
ctx.commit('setOrders', data.orders)
ctx.commit('setUsers', data.users)
ctx.commit('setProducts', data.products)
ctx.commit('updatePagination', data.pagination)
} catch (e) {
console.error(e)
}
}
IN COMPONENT:
<select v-model="product">
<option v-for="product in products" :key="product.code" :value="product">
{{ product.title }}
</option>
</select>
When you do this way, the whole selected product would be saved in the product data property.
Source:stackexchange.com