Browse Source

Property fixes & Search

master
George Williams 5 years ago
parent
commit
30a5cf93be

+ 37
- 55
src/components/property/propertyCreate.vue View File

@@ -69,11 +69,9 @@
69 69
                     v-model="property.propertyTypeId"
70 70
                   >
71 71
                     <option value="0">Please select type</option>
72
-                    <option
73
-                      v-for="item in propertyTypes"
74
-                      :value="item.id"
75
-                      :key="item.id"
76
-                    >{{ item.description }}</option>
72
+                    <option v-for="item in propertyTypes" :value="item.id" :key="item.id">{{
73
+                      item.description
74
+                    }}</option>
77 75
                   </select>
78 76
                 </div>
79 77
               </div>
@@ -152,11 +150,9 @@
152 150
                     v-model="property.provinceId"
153 151
                   >
154 152
                     <option value="0">Please select province</option>
155
-                    <option
156
-                      v-for="province in provinces"
157
-                      :value="province.id"
158
-                      :key="province.id"
159
-                    >{{ province.description }}</option>
153
+                    <option v-for="province in provinces" :value="province.id" :key="province.id">{{
154
+                      province.description
155
+                    }}</option>
160 156
                   </select>
161 157
                 </div>
162 158
               </div>
@@ -175,11 +171,9 @@
175 171
                     v-model="property.cityId"
176 172
                   >
177 173
                     <option value="0">Please select city</option>
178
-                    <option
179
-                      v-for="city in cities"
180
-                      :value="city.id"
181
-                      :key="city.id"
182
-                    >{{ city.description }}</option>
174
+                    <option v-for="city in cities" :value="city.id" :key="city.id">{{
175
+                      city.description
176
+                    }}</option>
183 177
                   </select>
184 178
                 </div>
185 179
               </div>
@@ -197,11 +191,9 @@
197 191
                     @change="getPostalCode"
198 192
                   >
199 193
                     <option value="0">Please select suburb</option>
200
-                    <option
201
-                      v-for="suburb in suburbs"
202
-                      :value="suburb.id"
203
-                      :key="suburb.id"
204
-                    >{{ suburb.description }}</option>
194
+                    <option v-for="suburb in suburbs" :value="suburb.id" :key="suburb.id">{{
195
+                      suburb.description
196
+                    }}</option>
205 197
                   </select>
206 198
                 </div>
207 199
               </div>
@@ -263,12 +255,15 @@
263 255
                 <label for="Property Description">Description</label>
264 256
                 <vue-editor v-model="property.description" :editor-toolbar="customToolbar" />
265 257
                 <br />
266
-                <p>* A listing fee of R380 including VAT is payable to list your Property on the Uni-Vate website</p>
258
+                <p>
259
+                  * A listing fee of R380 including VAT is payable to list your Property on the
260
+                  Uni-Vate website
261
+                </p>
267 262
               </div>
268 263
             </div>
269 264
             <div class="form-group row" />
270 265
             <UserField
271
-              v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
266
+              v-if="(propertyType === 'Residential') & (propertyOverviewFields.length > 0)"
272 267
               :fields="propertyOverviewFields[0].fields"
273 268
               @UpdateUserDefinedFields="UpdateUserDefinedFields"
274 269
               :id="1"
@@ -348,7 +343,9 @@
348 343
               @click="SubmitData()"
349 344
               class="btn btn-b-n"
350 345
               style="width: 85px; height:40px;"
351
-            >Save</button>
346
+            >
347
+              Save
348
+            </button>
352 349
             <div v-if="wait" id="preloader"></div>
353 350
           </form>
354 351
         </div>
@@ -360,7 +357,6 @@
360 357
 <script>
361 358
 import { mapState, mapActions } from 'vuex';
362 359
 import { VueEditor } from 'vue2-editor';
363
-import { setTimeout } from 'timers';
364 360
 import UserField from './propertyUserField.vue';
365 361
 import ImageLoad from './propertyImage.vue';
366 362
 
@@ -384,16 +380,12 @@ export default {
384 380
       customToolbar: [
385 381
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
386 382
         ['bold', 'italic', 'underline', 'strike'],
387
-        [
388
-          { align: '' },
389
-          { align: 'center' },
390
-          { align: 'right' },
391
-          { align: 'justify' },
392
-        ],
383
+        [{ align: '' }, { align: 'center' }, { align: 'right' }, { align: 'justify' }],
393 384
         [{ list: 'ordered' }, { list: 'bullet' }, { list: 'check' }],
394 385
         [{ script: 'sub' }, { script: 'super' }],
395 386
         [{ indent: '-1' }, { indent: '+1' }],
396 387
       ],
388
+      error: '',
397 389
     };
398 390
   },
399 391
   methods: {
@@ -433,47 +425,37 @@ export default {
433 425
       }
434 426
       this.property.propertyUserFields = this.propertyFieldValues;
435 427
 
436
-      this.property.userId = this.user.id;
437
-      this.saveProperty(this.property);
438
-      setTimeout(
439
-        () => this.$router.push({
440
-            path: '/property/Search',
441
-            query: {
442
-              salesType: this.salesType,
443
-              propertyUsageType: this.propertyType,
444
-            },
445
-          }),
446
-        3000,
447
-      );
428
+      if (this.user) {
429
+        this.property.userId = this.user.id;
430
+      }
431
+
432
+      this.saveProperty(this.property)
433
+        .then((fulfilled) => {
434
+          this.$router.push(`/property/property/${fulfilled.data.id}`);
435
+        })
436
+        .catch((error) => {
437
+          console.log(error.message);
438
+        });
448 439
     },
449 440
     Close() {
450 441
       this.$router.push('/property/admin/list/my');
451 442
     },
452 443
     ProvinceSelected(item) {
453 444
       if (item.target.options.selectedIndex > 0) {
454
-        this.selectedProvince = this.provinces[
455
-          item.target.options.selectedIndex - 1
456
-        ].description;
445
+        this.selectedProvince = this.provinces[item.target.options.selectedIndex - 1].description;
457 446
         this.getCities(Object.assign({}, { province: this.selectedProvince }));
458 447
       }
459 448
     },
460 449
     CitySelected(item) {
461 450
       if (item.target.options.selectedIndex > 0) {
462
-        this.selectedCity = this.cities[
463
-          item.target.options.selectedIndex - 1
464
-        ].description;
451
+        this.selectedCity = this.cities[item.target.options.selectedIndex - 1].description;
465 452
         this.getSuburbs(
466
-          Object.assign(
467
-            {},
468
-            { province: this.selectedProvince, city: this.selectedCity },
469
-          ),
453
+          Object.assign({}, { province: this.selectedProvince, city: this.selectedCity }),
470 454
         );
471 455
       }
472 456
     },
473 457
     getPostalCode(item) {
474
-      this.property.addressLine3 = this.suburbs[
475
-        item.target.options.selectedIndex - 1
476
-      ].postalCode;
458
+      this.property.addressLine3 = this.suburbs[item.target.options.selectedIndex - 1].postalCode;
477 459
     },
478 460
     loadedImages(values) {
479 461
       this.images = values;

+ 33
- 84
src/components/property/propertyList.vue View File

@@ -2,75 +2,27 @@
2 2
   <!-- eslint-disable max-len -->
3 3
   <div>
4 4
     <div class="container">
5
-      <!-- <section class="intro-single"> -->
6 5
       <div class="container">
7
-        <br />
8
-        <br />
9 6
         <br />
10 7
         <br />
11 8
         <div class="row">
12 9
           <div class="col-md-12 col-lg-8">
13 10
             <div class="title-box-d">
14
-              <h1
15
-                v-if="showAdmin"
16
-                class="title-d"
17
-                style="text-align:left; font-size: 250%"
18
-              >Admin Properties</h1>
19
-              <h1 v-else class="title-d" style="text-align:left; font-size: 250%">My Properties</h1>
11
+              <h1 class="title-d" style="text-align:left; font-size: 250%">Properties</h1>
20 12
             </div>
21 13
           </div>
22 14
         </div>
23 15
       </div>
24
-      <!-- </section> -->
25 16
     </div>
26 17
     <div class="container">
27
-      <table class="table table-bordered">
28
-        <thead>
29
-          <tr>
30
-            <th>Name</th>
31
-            <th>Property ID</th>
32
-            <th>Size</th>
33
-            <th>Price</th>
34
-            <th>Usage Type</th>
35
-            <th>Type</th>
36
-            <th>Sale Type</th>
37
-            <th>Publish</th>
38
-            <th>Status</th>
39
-            <th></th>
40
-            <th></th>
41
-          </tr>
42
-        </thead>
43
-        <tbody>
44
-          <tr v-for="(item, i) in properties" :key="i">
45
-            <td>{{ item.name }}</td>
46
-            <td>{{ item.id }}</td>
47
-            <td v-html="item.size" />
48
-            <td>{{ item.price }}</td>
49
-            <td>{{ item.usageType }}</td>
50
-            <td>{{ item.type }}</td>
51
-            <td>{{ item.saleType }}</td>
52
-            <!-- <td>{{ item.publish }}</td> -->
53
-            <td></td>
54
-            <td>{{ item.status }}</td>
55
-            <td>
56
-              <button
57
-                type="button"
58
-                @click="Edit(item)"
59
-                class="btn"
60
-                style="margin:2px; color: #60CBEB"
61
-              >Edit</button>
62
-            </td>
63
-            <td>
64
-              <button
65
-                type="button"
66
-                @click="Delete(item)"
67
-                class="btn btn-b-n"
68
-                style="width: 85px; height:40px;"
69
-              >Delete</button>
70
-            </td>
71
-          </tr>
72
-        </tbody>
73
-      </table>
18
+      <listView
19
+        :items="properties"
20
+        :showNew="false"
21
+        :editable="true"
22
+        :deleteable="true"
23
+        @onEdit="Edit"
24
+        @onDelete="Delete"
25
+      />
74 26
     </div>
75 27
     <br />
76 28
   </div>
@@ -78,13 +30,17 @@
78 30
 
79 31
 <script>
80 32
 import { mapState, mapActions } from 'vuex';
33
+import listView from '../shared/listView.vue';
81 34
 
82 35
 export default {
83 36
   name: 'PropertyList',
37
+  components: {
38
+    listView,
39
+  },
84 40
   data() {
85 41
     return {
86 42
       propertyType: '',
87
-      showAdmin: false,
43
+      role: 'MY',
88 44
     };
89 45
   },
90 46
   methods: {
@@ -101,45 +57,38 @@ export default {
101 57
     },
102 58
   },
103 59
   mounted() {
104
-    if (this.$route.params.by === 'my') {
105
-      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
106
-      this.showAdmin = false;
107
-    } else {
108
-      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
109
-      this.showAdmin = true;
60
+    if (this.user.role === 'Super Admin') {
61
+      this.role = 'SUPERADMIN';
62
+    }
63
+    if (this.user.role === 'Agency') {
64
+      this.user.role = 'ADMIN';
110 65
     }
111
-
112
-    // this.user = 28; // user id
113 66
 
114 67
     this.getProperties(
115
-      Object.assign(
116
-        {},
117
-        {
118
-          propertyType: this.showAdmin ? 'Admin' : 'My',
119
-          user: this.user.id,
120
-        },
121
-      ),
68
+      Object.assign({
69
+        propertyType: this.role,
70
+        user: this.user.id,
71
+      }),
122 72
     );
123 73
   },
124 74
   computed: {
125 75
     ...mapState('propertyList', ['properties']),
126 76
     ...mapState('authentication', ['user']),
127 77
     UserChanged() {
128
-      if (this.$route.params.by === 'my') {
78
+      if (this.user.role === 'Super Admin') {
129 79
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
130
-        this.showAdmin = false;
131
-      } else {
80
+        this.role = 'SUPERADMIN';
81
+      }
82
+      if (this.user.role === 'Agency') {
132 83
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
133
-        this.showAdmin = true;
84
+        this.user.role = 'ADMIN';
134 85
       }
86
+
135 87
       this.getProperties(
136
-        Object.assign(
137
-          {},
138
-          {
139
-            propertyType: this.showAdmin ? 'Admin' : 'My',
140
-            user: this.user,
141
-          },
142
-        ),
88
+        Object.assign({
89
+          propertyType: this.role,
90
+          user: this.user.id,
91
+        }),
143 92
       );
144 93
       return this.user;
145 94
     },

+ 0
- 3
src/components/property/propertyPage.vue View File

@@ -2,9 +2,6 @@
2 2
   <!-- eslint-disable max-len -->
3 3
   <div v-if="property">
4 4
     <div class="container">
5
-      <br />
6
-      <br />
7
-      <br />
8 5
       <br />
9 6
       <div class="row">
10 7
         <div class="col-md-12 col-lg-8">

+ 9
- 24
src/components/property/propertySearchFields.vue View File

@@ -29,10 +29,9 @@
29 29
           </div>
30 30
           <select class="form-control" v-model="resType" @change="PropertyTypeSelected">
31 31
             <option>All</option>
32
-            <option
33
-              v-for="(propertyType, i) in propertyTypesRes"
34
-              :key="i"
35
-            >{{ propertyType.description }}</option>
32
+            <option v-for="(propertyType, i) in propertyTypesRes" :key="i">{{
33
+              propertyType.description
34
+            }}</option>
36 35
           </select>
37 36
           <div class="input-group-append" @click="clearResType">
38 37
             <span class="input-group-text cursor-pointer" style="color: #60CBEB">
@@ -51,10 +50,9 @@
51 50
           </div>
52 51
           <select class="form-control" v-model="comType" @change="PropertyTypeSelected">
53 52
             <option>All</option>
54
-            <option
55
-              v-for="(propertyType, i) in propertyTypesCom"
56
-              :key="i"
57
-            >{{ propertyType.description }}</option>
53
+            <option v-for="(propertyType, i) in propertyTypesCom" :key="i">{{
54
+              propertyType.description
55
+            }}</option>
58 56
           </select>
59 57
           <div class="input-group-append" @click="clearComType">
60 58
             <span class="input-group-text cursor-pointer" style="color: #60CBEB">
@@ -139,8 +137,7 @@
139 137
               <input
140 138
                 class="form-control"
141 139
                 type="number"
142
-                step="any"
143
-                name="minPrice"
140
+                setp="any"
144 141
                 v-model="propertySearch.minPrice"
145 142
               />
146 143
               <div class="input-group-append" @click="clearFilter('minPrice')">
@@ -161,8 +158,7 @@
161 158
               <input
162 159
                 class="form-control"
163 160
                 type="number"
164
-                step="any"
165
-                name="maxPrice"
161
+                setp="any"
166 162
                 v-model="propertySearch.maxPrice"
167 163
               />
168 164
               <div class="input-group-append" @click="clearFilter('maxPrice')">
@@ -216,20 +212,13 @@ export default {
216 212
       this.clearFilter('propertyType');
217 213
       this.comType = 'All';
218 214
     },
219
-    salesTypeSelected() {
220
-      this.$emit('updateSearch', this.propertySearch);
221
-    },
222 215
     PropertyTypeSelected(item) {
223 216
       this.propertySearch.propertyType = item.target.value;
224
-      this.$emit('updateSearch', this.propertySearch);
225 217
     },
226 218
     ProvinceSelected(item) {
227 219
       if (item.target.value !== 'All') {
228
-        this.getCities(
229
-          Object.assign({}, { province: this.propertySearch.province }),
230
-        );
220
+        this.getCities(Object.assign({}, { province: this.propertySearch.province }));
231 221
       }
232
-      this.$emit('updateSearch', this.propertySearch);
233 222
     },
234 223
     CitySelected(item) {
235 224
       if (item.target.value !== 'All') {
@@ -243,10 +232,6 @@ export default {
243 232
           ),
244 233
         );
245 234
       }
246
-      this.$emit('updateSearch', this.propertySearch);
247
-    },
248
-    SuburbSeleted() {
249
-      this.$emit('updateSearch', this.propertySearch);
250 235
     },
251 236
   },
252 237
 };

+ 13
- 45
src/components/property/propertySearchResults.vue View File

@@ -65,51 +65,19 @@ export default {
65 65
   computed: {
66 66
     ...mapState('propertySearch', ['properties', 'propertySearch']),
67 67
     ...mapState('authentication', ['username']),
68
-    // ParamsChanged() {
69
-    //   if (Object.keys(this.$route.query).length === 0) {
70
-    //     if (this.propertySearch.propertyUsageType === 'All') {
71
-    //       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
72
-    //       this.propertySearch.propertyUsageType = 'Residential';
73
-    //       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
74
-    //       this.propertySearch.keyword = 'All';
75
-    //       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
76
-    //       this.propertySearch.salesType = 'All';
77
-    //     }
78
-    //   }
79
-    //   if (Object.keys(this.$route.query).length > 0) {
80
-    //     if (Object.keys(this.$route.query).length > 2) {
81
-    //       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
82
-    //       this.propertySearch = this.$route.query;
83
-    //     } else {
84
-    //       if (this.$route.query.salesType) {
85
-    //         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
86
-    //         this.propertySearch.salesType = this.$route.query.salesType;
87
-    //       }
88
-    //       if (this.$route.query.propertyUsageType) {
89
-    //         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
90
-    //         this.propertySearch.propertyUsageType = this.$route.query.propertyUsageType;
91
-    //       }
92
-    //     }
93
-    //   }
94
-    //   if (this.propertySearch.keyword === '') {
95
-    //     // eslint-disable-next-line vue/no-side-effects-in-computed-properties
96
-    //     this.propertySearch.keyword = 'All';
97
-    //   }
98
-    //   if (this.username) {
99
-    //     // eslint-disable-next-line vue/no-side-effects-in-computed-properties
100
-    //     this.propertySearch.userName = this.username;
101
-    //   } else {
102
-    //     // eslint-disable-next-line vue/no-side-effects-in-computed-properties
103
-    //     this.propertySearch.userName = 'Unknown';
104
-    //   }
105
-    //   this.searchProperties(this.propertySearch);
106
-    //   return null;
107
-    // },
68
+    ParamsChanged() {
69
+      if (typeof this.propertySearch.propertyUsageType === 'undefined') {
70
+        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
71
+        this.propertySearch.propertyUsageType = 'Residential';
72
+      }
73
+      this.searchProperties(this.propertySearch);
74
+      return null;
75
+    },
76
+  },
77
+  watch: {
78
+    ParamsChanged() {
79
+      return null;
80
+    },
108 81
   },
109
-  //   watch: {
110
-  //     ParamsChanged() {
111
-  //       return null;
112
-  //     },
113
-  //   },
114 82
 };
115 83
 </script>

+ 3
- 11
src/components/property/propertyeditPage.vue View File

@@ -535,20 +535,12 @@ export default {
535 535
       this.updateProperty({
536 536
         property: this.property,
537 537
         images: this.newPropertyImages,
538
+      }).then(() => {
539
+        this.$router.push('/properties');
538 540
       });
539
-
540
-      // console.log(JSON.stringify(this.newPropertyImages));
541
-
542
-      // Need to change to promis.
543
-      setTimeout(
544
-        () => this.$router.push({
545
-            path: '/property/admin/list/my',
546
-          }),
547
-        5000,
548
-      );
549 541
     },
550 542
     Close() {
551
-      this.$router.push('/property/admin/list/my');
543
+      this.$router.push('/properties');
552 544
     },
553 545
     loadedImages(values) {
554 546
       this.images = values;

+ 2
- 2
src/components/shared/navBar.vue View File

@@ -91,11 +91,11 @@
91 91
                   class="dropdown-item cursor-pointer"
92 92
                   @click="routerGoTo('/property/new/Rental')"
93 93
                 >To Rent</a>
94
-                <hr />
94
+                <hr v-if="isLoggedIn" />
95 95
                 <a
96 96
                   v-if="isLoggedIn"
97 97
                   class="dropdown-item cursor-pointer"
98
-                  @click="routerGoTo('/property/admin/list/my')"
98
+                  @click="routerGoTo('/properties')"
99 99
                 >My Properties</a>
100 100
               </div>
101 101
             </li>

+ 9
- 14
src/components/shared/searchTab.vue View File

@@ -38,7 +38,8 @@
38 38
                   aria-controls="pills-video"
39 39
                   aria-selected="true"
40 40
                   v-on:click="updateType('Timeshare')"
41
-                >Timeshare</a>
41
+                  >Timeshare</a
42
+                >
42 43
               </li>
43 44
               <li class="nav-item">
44 45
                 <a
@@ -50,7 +51,8 @@
50 51
                   aria-controls="pills-plans"
51 52
                   aria-selected="false"
52 53
                   v-on:click="updateType('Residential')"
53
-                >Residential</a>
54
+                  >Residential</a
55
+                >
54 56
               </li>
55 57
               <li class="nav-item">
56 58
                 <a
@@ -62,7 +64,8 @@
62 64
                   aria-controls="pills-map"
63 65
                   aria-selected="false"
64 66
                   v-on:click="updateType('Commercial')"
65
-                >Commercial</a>
67
+                  >Commercial</a
68
+                >
66 69
               </li>
67 70
             </ul>
68 71
             <div class="tab-content" id="pills-tabContent">
@@ -80,7 +83,7 @@
80 83
                 role="tabpanel"
81 84
                 aria-labelledby="pills-plans-tab"
82 85
               >
83
-                <propertySearch propertyType="Residential" @updateSearch="updateSearch" />
86
+                <propertySearch propertyType="Residential" />
84 87
               </div>
85 88
               <div
86 89
                 class="tab-pane fade"
@@ -88,7 +91,7 @@
88 91
                 role="tabpanel"
89 92
                 aria-labelledby="pills-map-tab"
90 93
               >
91
-                <propertySearch propertyType="Commercial" @updateSearch="updateSearch" />
94
+                <propertySearch propertyType="Commercial" />
92 95
               </div>
93 96
             </div>
94 97
           </div>
@@ -125,20 +128,12 @@ export default {
125 128
     updateType(item) {
126 129
       this.selectedPropertyType = item;
127 130
     },
128
-    updateSearch(item) {
129
-      this.propertySearch = item;
130
-      this.propertySearch.propertyUsageType = this.selectedPropertyType;
131
-      this.propertySearch.keyword = this.filter.keyword;
132
-    },
133 131
     Search() {
134 132
       if (this.selectedPropertyType === 'timeshare') {
135 133
         this.$router.push('/timesharesearch');
136 134
       } else {
135
+        this.propertySearch.propertyUsageType = this.selectedPropertyType;
137 136
         this.$router.push('/property/propertySearch/results');
138
-        // this.$router.push({
139
-        //   path: '/property/search',
140
-        //   query: this.propertySearch,
141
-        // });
142 137
       }
143 138
     },
144 139
   },

+ 1
- 1
src/router/index.js View File

@@ -154,7 +154,7 @@ export default new Router({
154 154
       component: PropertyEdit,
155 155
     },
156 156
     {
157
-      path: '/property/admin/list/:by',
157
+      path: '/properties',
158 158
       name: 'PropertyListAdmin',
159 159
       component: PropertyList,
160 160
     },

+ 11
- 4
src/store/modules/property/property.js View File

@@ -148,10 +148,17 @@ export default {
148 148
         .catch(console.error);
149 149
     },
150 150
     saveProperty({ commit }, item) {
151
-      axios
152
-        .post('/api/Property', item)
153
-        .then(result => commit('updateCurrentProperty', result.data))
154
-        .catch(console.error);
151
+      return new Promise((resolve, reject) => {
152
+        axios
153
+          .post('/api/Property', item)
154
+          .then((resp) => {
155
+            commit('updateCurrentProperty', resp);
156
+            resolve(resp);
157
+          })
158
+          .catch(() => {
159
+            reject(console.error);
160
+          });
161
+      });
155 162
     },
156 163
     clearProperty({ commit }) {
157 164
       commit('clearProperty');

+ 11
- 8
src/store/modules/property/propertyEdit.js View File

@@ -123,15 +123,18 @@ export default {
123 123
         .catch(console.error);
124 124
     },
125 125
     updateProperty({ commit }, item) {
126
-      axios
127
-        .post('/api/PropertyImage', item.images)
128
-        .then(commit('ClearNewImages'))
129
-        .catch(console.error);
126
+      return new Promise((resolve) => {
127
+        axios
128
+          .post('/api/PropertyImage', item.images)
129
+          .then(commit('ClearNewImages'))
130
+          .catch(console.error);
130 131
 
131
-      axios
132
-        .put('/api/Property', item.property)
133
-        .then(commit('setProperty', item.property))
134
-        .catch(console.error);
132
+        axios
133
+          .put('/api/Property', item.property)
134
+          .then(commit('setProperty', item.property))
135
+          .catch(console.error);
136
+        resolve(true);
137
+      });
135 138
     },
136 139
     mayEditProperty({ commit }, id) {
137 140
       axios

Loading…
Cancel
Save