mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 22:46:13 +00:00
address selection: order preferred countries
This commit is contained in:
parent
fee37b5af3
commit
b51575fc49
@ -6,7 +6,7 @@
|
|||||||
const fetchCountries = () => {
|
const fetchCountries = () => {
|
||||||
console.log('<<< fetching countries');
|
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)
|
return fetch(url)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.ok) { return response.json(); }
|
if (response.ok) { return response.json(); }
|
||||||
@ -21,6 +21,7 @@ const fetchCountries = () => {
|
|||||||
const fetchCities = (country) => {
|
const fetchCities = (country) => {
|
||||||
console.log('<<< fetching cities for', country);
|
console.log('<<< fetching cities for', country);
|
||||||
//TODO use 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`;
|
const url = `/api/1.0/main/postal-code.json`;
|
||||||
return fetch(url)
|
return fetch(url)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
@ -21,7 +21,12 @@ export default {
|
|||||||
props: ['address', 'getCities'],
|
props: ['address', 'getCities'],
|
||||||
computed: {
|
computed: {
|
||||||
countries() {
|
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: {
|
selected: {
|
||||||
set(value) {
|
set(value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user