Merge pull request #734 from Safelite/feature/richardson/SSR-1294
google map update
This commit is contained in:
commit
282e060fdd
1 changed files with 17 additions and 3 deletions
|
|
@ -195,7 +195,7 @@ export default {
|
|||
this.autocomplete = new window.google.maps.places.Autocomplete(document.getElementById('autocomplete'), {
|
||||
componentRestrictions: { country: ['us'] },
|
||||
fields: ['address_components'],
|
||||
types: ['geocode']
|
||||
types: ['address']
|
||||
});
|
||||
|
||||
// Set up the Autocomplete place_changed event to call our method to fill in the address
|
||||
|
|
@ -229,16 +229,30 @@ export default {
|
|||
this.$nextTick(() => {
|
||||
this.showAllFields = true;
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
let processedStreetAddress = false;
|
||||
let processedRoute = false;
|
||||
for (const component of googlePlace.address_components) {
|
||||
const componentType = component.types[0];
|
||||
|
||||
switch (componentType) {
|
||||
case 'street_number': {
|
||||
self.addressModel.streetAddress = component.long_name;
|
||||
if (processedRoute) {
|
||||
self.addressModel.streetAddress = `${component.long_name} ${self.addressModel.streetAddress}`;
|
||||
} else {
|
||||
self.addressModel.streetAddress = component.long_name;
|
||||
}
|
||||
|
||||
processedStreetAddress = true;
|
||||
break;
|
||||
}
|
||||
case 'route': {
|
||||
self.addressModel.streetAddress += ` ${component.short_name}`;
|
||||
if (processedStreetAddress) {
|
||||
self.addressModel.streetAddress += ` ${component.short_name}`;
|
||||
} else {
|
||||
self.addressModel.streetAddress = component.short_name;
|
||||
}
|
||||
|
||||
processedRoute = true;
|
||||
break;
|
||||
}
|
||||
case 'locality': {
|
||||
|
|
|
|||
Loading…
Reference in a new issue