From 9b77f9ec2c00b48c551f65b2e9d7a087004de4c0 Mon Sep 17 00:00:00 2001
From: "Adam T. Carpenter" <atc@53hor.net>
Date: Thu, 12 Nov 2020 16:27:13 -0500
Subject: Noice. Product creation and updating is totally functional.

---
 iridescence/src/components/admin/NewProduct.vue | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

(limited to 'iridescence/src/components/admin/NewProduct.vue')

diff --git a/iridescence/src/components/admin/NewProduct.vue b/iridescence/src/components/admin/NewProduct.vue
index 48eb165..cd8a93e 100644
--- a/iridescence/src/components/admin/NewProduct.vue
+++ b/iridescence/src/components/admin/NewProduct.vue
@@ -17,7 +17,7 @@
             <button class="delete" @click="toggleModal"></button>
           </header>
           <section class="modal-card-body">
-            <ProductEditCard v-bind:parent-product="template"></ProductEditCard>
+            <ProductEditCard v-bind:index="-1"></ProductEditCard>
           </section>
           <footer class="modal-card-foot"></footer>
         </div>
@@ -27,7 +27,6 @@
 </template>
 
 <script>
-import Product from "@/models/product";
 import ProductEditCard from "@/components/admin/ProductEditCard";
 
 export default {
@@ -37,11 +36,19 @@ export default {
   },
   data: function() {
     return {
-      modalEnabled: false,
-      template: new Product({}),
-      addAnother: false
+      modalEnabled: false
     };
   },
+  computed: {
+    numProducts: function() {
+      return this.$store.getters.products.length;
+    }
+  },
+  watch: {
+    numProducts: function() {
+      this.modalEnabled = false;
+    }
+  },
   methods: {
     toggleModal() {
       this.modalEnabled = !this.modalEnabled;
-- 
cgit v1.2.3

