Small fix

This commit is contained in:
megavrilinvv
2022-11-15 18:27:35 +03:00
parent f3979e9e24
commit 040312c035

View File

@@ -333,6 +333,16 @@ export default {
}; };
} }
}, },
mergeFullAddress() {
if (
this.dopeAddress.region &&
this.dopeAddress.city &&
this.dopeAddress.street &&
this.dopeAddress.house
) {
return `${this.dopeAddress.region}.обл, г.${this.dopeAddress.city}, ул.${this.dopeAddress.street}, ${this.dopeAddress.house}, ${this.dopeAddress.flat}, ${this.dopeAddress.index}`;
}
},
clearAddress() { clearAddress() {
this.dopeAddress = { this.dopeAddress = {
city: "", city: "",
@@ -346,13 +356,7 @@ export default {
postUpdateAddress() { postUpdateAddress() {
fetchWrapper fetchWrapper
.post(`general/address/${this.addressId}/update/`, { .post(`general/address/${this.addressId}/update/`, {
full_address: full_address: this.mergeFullAddress() || this.dataAddress.join_adress,
this.dopeAddress.city +
this.dopeAddress.region +
this.dopeAddress.street +
this.dopeAddress.house +
this.dopeAddress.flat +
this.dopeAddress.index || this.dataAddress.join_adress,
}) })
.then(() => this.fetchClientDetail(this.id)); .then(() => this.fetchClientDetail(this.id));
this.clearAddress(); this.clearAddress();
@@ -385,13 +389,7 @@ export default {
fetchWrapper fetchWrapper
.post("general/address/create/", { .post("general/address/create/", {
person_id: this.id, person_id: this.id,
full_address: full_address: this.mergeFullAddress() || this.dataAddress.join_adress,
this.dopeAddress.city +
this.dopeAddress.region +
this.dopeAddress.street +
this.dopeAddress.house +
this.dopeAddress.flat +
this.dopeAddress.index || this.dataAddress.join_adress,
}) })
.then(() => this.fetchClientDetail(this.id)); .then(() => this.fetchClientDetail(this.id));
}, },