Uses prop "to" to send to edit from admin page.

This commit is contained in:
2020-07-21 18:44:54 +02:00
parent 8f5dc52dc5
commit c09a29134d
2 changed files with 9 additions and 3 deletions

View File

@@ -7,7 +7,9 @@
</div>
<div v-if="products && products.length" class="products">
<add-card />
<product-card v-for="product in products" :product="product" />
<product-card v-for="product in products"
:product="product"
:to="'/edit/' + product.urlSlug" :key="Math.random()" />
</div>
<span v-else>

View File

@@ -40,7 +40,11 @@ export default {
product: {
type: Object,
required: true
}
},
to: {
type: String,
required: false
}
},
data() {
return {
@@ -64,7 +68,7 @@ export default {
store.dispatch('cartModule/addItemToCart', { ...this.product });
},
viewProduct() {
this.$router.push('/shop/' + this.product.urlSlug)
this.$router.push(this.to ? this.to : '/shop/' + this.product.urlSlug)
}
}
}