mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 06:26:15 +00:00
address selection: order preferred countries
This commit is contained in:
parent
fee37b5af3
commit
b51575fc49
@ -6,7 +6,7 @@
|
||||
const fetchCountries = () => {
|
||||
console.log('<<< fetching countries');
|
||||
|
||||
const url = `/api/1.0/main/country.json`;
|
||||
const url = `/api/1.0/main/country.json?item_per_page=1000`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
@ -21,6 +21,7 @@ const fetchCountries = () => {
|
||||
const fetchCities = (country) => {
|
||||
console.log('<<< fetching cities for', country);
|
||||
//TODO use country
|
||||
//TODO deal with huge number of postal code ... we should do suggestion...
|
||||
const url = `/api/1.0/main/postal-code.json`;
|
||||
return fetch(url)
|
||||
.then(response => {
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user