mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
addresses: filter out postal code introduced by user
This commit is contained in:
@@ -45,10 +45,12 @@ const store = createStore({
|
||||
console.log('@A addAddress payload', payload);
|
||||
|
||||
if('newPostalCode' in payload){
|
||||
postPostalCode(payload.newPostalCode)
|
||||
let postalCodeBody = payload.newPostalCode;
|
||||
postalCodeBody = Object.assign(postalCodeBody, {'origin': 3});
|
||||
postPostalCode(postalCodeBody)
|
||||
.then(postalCode => {
|
||||
let body = payload;
|
||||
body.postcode = {'id': postalCode.id },
|
||||
body.postcode = {'id': postalCode.id},
|
||||
postAddress(body)
|
||||
.then(address => new Promise((resolve, reject) => {
|
||||
commit('addAddress', address);
|
||||
@@ -95,7 +97,9 @@ const store = createStore({
|
||||
console.log('@A updateAddress payload', payload);
|
||||
|
||||
if('newPostalCode' in payload.newAddress){ // TODO change the condition because it writes new postal code in edit mode now: !writeNewPostalCode
|
||||
postPostalCode(payload.newAddress.newPostalCode)
|
||||
let postalCodeBody = payload.newAddress.newPostalCode;
|
||||
postalCodeBody = Object.assign(postalCodeBody, {'origin': 3});
|
||||
postPostalCode(postalCodeBody)
|
||||
.then(postalCode => {
|
||||
let body = payload.newAddress;
|
||||
body.postcode = {'id': postalCode.id },
|
||||
|
@@ -181,8 +181,8 @@ export default {
|
||||
getCities(country) {
|
||||
console.log('getCities for', country.name);
|
||||
fetchCities(country).then(cities => new Promise((resolve, reject) => {
|
||||
this.address.loaded.cities = cities.results;
|
||||
resolve()
|
||||
this.address.loaded.cities = cities.results.filter(c => c.origin !== 3); // filter out user-defined cities
|
||||
resolve();
|
||||
}))
|
||||
.catch((error) => {
|
||||
this.errorMsg.push(error.message);
|
||||
|
Reference in New Issue
Block a user