diff --git a/assets/client.js b/assets/client.js
index a402abe..b50fbb0 100644
--- a/assets/client.js
+++ b/assets/client.js
@@ -122,19 +122,16 @@ function plotAirports (airports) {
marker.IATA = airport.IATA
marker.addListener('click', function () {
if (openInfoWindow) openInfoWindow.close()
- // eslint-disable-next-line no-undef
- const infoWindow = new google.maps.InfoWindow({
- content: `
-
${airport.name}
-
- IATA | ${airport.IATA || 'n/a'} |
- ICAO | ${airport.ICAO || 'n/a'} |
- Altitude | ${airport.altitude === null ? 'n/a' : airport.altitude + ' ft'} |
-
- `
- })
- infoWindow.open(map, marker)
- openInfoWindow = infoWindow
+ else openInfoWindow = new google.maps.InfoWindow() // eslint-disable-line no-undef
+ openInfoWindow.setContent(`
+ ${airport.name}
+
+ IATA | ${airport.IATA || 'n/a'} |
+ ICAO | ${airport.ICAO || 'n/a'} |
+ Altitude | ${airport.altitude === null ? 'n/a' : airport.altitude + ' ft'} |
+
+ `)
+ openInfoWindow.open(map, marker)
})
airportMarkers.push(marker)
})