Merge branch 'address_refactoring' into add-location-period

This commit is contained in:
Mathieu Jaumotte 2021-08-13 16:13:09 +02:00
commit ea691d9b32

View File

@ -475,7 +475,7 @@ export default {
// TODO change the condition because it writes new postal code in edit mode now: !writeNewPostalCode // TODO change the condition because it writes new postal code in edit mode now: !writeNewPostalCode
this.flag.loading = true; this.flag.loading = true;
if ('newPostcode' in payload.newAddress) { if ('newPostcode' in payload.newAddress) {
let postcodeBody = payload.newAddress.newPostcode; let postcodeBody = payload.newAddress.newPostcode;
postcodeBody = Object.assign(postcodeBody, {'origin': 3}); postcodeBody = Object.assign(postcodeBody, {'origin': 3});
@ -570,9 +570,7 @@ export default {
case 'household': case 'household':
postAddressToHousehold(payload.entityId, payload.addressId) postAddressToHousehold(payload.entityId, payload.addressId)
.then(household => new Promise((resolve, reject) => { .then(household => new Promise((resolve, reject) => {
console.log('postAddressToHousehold', household);
console.log('commit addAddressToHousehold', household);
this.flag.loading = false; this.flag.loading = false;
this.flag.success = true; this.flag.success = true;
window.location.assign(payload.backUrl); window.location.assign(payload.backUrl);
@ -587,9 +585,7 @@ export default {
case 'person': case 'person':
postAddressToPerson(payload.entityId, payload.addressId) postAddressToPerson(payload.entityId, payload.addressId)
.then(person => new Promise((resolve, reject) => { .then(person => new Promise((resolve, reject) => {
console.log('postAddressToPerson', person);
console.log('commit addAddressToPerson !!!', person);
this.flag.loading = false; this.flag.loading = false;
this.flag.success = true; this.flag.success = true;
window.location.assign(payload.backUrl); window.location.assign(payload.backUrl);
@ -604,7 +600,8 @@ export default {
default: default:
this.errorMsg.push('That entity is not managed by address !'); this.errorMsg.push('That entity is not managed by address !');
} }
} else { // address is already linked, just finish ! } else {
// address is already linked, just finish !
window.location.assign(payload.backUrl); window.location.assign(payload.backUrl);
} }
}, },