From bca39a475dfd3aab0b31709b2c4873398901b00c Mon Sep 17 00:00:00 2001
From: Andrew <saintruler@gmail.com>
Date: Fri, 19 Jul 2019 00:11:33 +0400
Subject: =?UTF-8?q?=D0=9A=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20=D1=83=D0=B4?=
 =?UTF-8?q?=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=80=D1=8F=D0=B4=D0=B0?=
 =?UTF-8?q?=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=B4=D0=B5=D0=B9?=
 =?UTF-8?q?=D1=81=D1=82=D0=B2=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=20?=
 =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 day9/task5_vue/src/components/EditFormBox.vue | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

(limited to 'day9/task5_vue/src/components/EditFormBox.vue')

diff --git a/day9/task5_vue/src/components/EditFormBox.vue b/day9/task5_vue/src/components/EditFormBox.vue
index 53bfd8b..389b549 100644
--- a/day9/task5_vue/src/components/EditFormBox.vue
+++ b/day9/task5_vue/src/components/EditFormBox.vue
@@ -1,7 +1,7 @@
 <template>
     <div class="backgroundTint shown">
         <div class="contentBox shown">
-            <form id="tableForm" action="/api/update" method="post">
+            <form ref="tableForm" action="/api/actionNotChanged" method="post">
                 <div class="formRow">
                     <div class="formRow-label">service_id</div>
 
@@ -88,13 +88,11 @@
                     </div>
                 </div>
 
-                <div class="formButtons" v-if="formType === 'update'">
+                <div class="formButtons">
                     <button type="button" @click="cancelCallback">Cancel</button>
-                    <button type="submit">Update</button>
-                </div>
-                <div class="formButtons" v-else-if="formType === 'create'">
-                    <button type="button">Cancel</button>
-                    <button type="submit">Create</button>
+
+                    <button type="submit" v-if="formType === 'update'">Update</button>
+                    <button type="submit" v-else-if="formType === 'create'">Create</button>
                 </div>
             </form>
         </div>
@@ -106,14 +104,12 @@
         name: "EditFormBox",
         props: ['formType', 'cancelCallback', 'tableRow'],
 
-        data() {
-            return {
-                row: this.tableRow
-            }
-        },
-
         mounted() {
-            console.log(this.row);
+            let action = '';
+            if (this.formType === 'create') action = '/api/add';
+            else if (this.formType === 'update') action = '/api/update';
+
+            this.$refs.tableForm.action = action;
         }
     }
 </script>
-- 
cgit v1.2.3

