address selection: order preferred countries

This commit is contained in:
nobohan
2021-05-12 15:03:15 +02:00
parent fee37b5af3
commit b51575fc49
2 changed files with 8 additions and 2 deletions

View File

@@ -21,7 +21,12 @@ export default {
props: ['address', 'getCities'],
computed: {
countries() {
return this.address.loaded.countries; // TODO place Belgium and France first
const countries = this.address.loaded.countries;
let orderedCountries = [];
orderedCountries.push(...countries.filter(c => c.countryCode === 'FR'))
orderedCountries.push(...countries.filter(c => c.countryCode === 'BE'))
orderedCountries.push(...countries.filter(c => c.countryCode !== 'FR').filter(c => c.countryCode !== 'BE'))
return orderedCountries;
},
selected: {
set(value) {