From c09a29134d66ea5458629732229efdce7b096653 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 21 Jul 2020 18:44:54 +0200 Subject: [PATCH] Uses prop "to" to send to edit from admin page. --- frontend/components/Admin.vue | 4 +++- frontend/components/ui/ProductCard.vue | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/components/Admin.vue b/frontend/components/Admin.vue index 3eb7217..28bccc5 100644 --- a/frontend/components/Admin.vue +++ b/frontend/components/Admin.vue @@ -7,7 +7,9 @@
- +
diff --git a/frontend/components/ui/ProductCard.vue b/frontend/components/ui/ProductCard.vue index cb062a0..fb93ba2 100644 --- a/frontend/components/ui/ProductCard.vue +++ b/frontend/components/ui/ProductCard.vue @@ -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) } } }