Fix google lib check for server rendering

This commit is contained in:
Kimmo Puputti 2018-03-22 11:17:12 +02:00
parent 22b71d3f27
commit fa7c813b39
2 changed files with 2 additions and 2 deletions

View file

@ -81,7 +81,7 @@ export class Map extends Component {
const location = coordinatesConfig.fuzzy ? obfuscatedCenter : center;
const centerLocationForGoogleMap = { lat: location.lat, lng: location.lng };
const isMapsLibLoaded = window.google && window.google.maps;
const isMapsLibLoaded = typeof window !== 'undefined' && window.google && window.google.maps;
return isMapsLibLoaded ? (
<MapWithGoogleMap

View file

@ -247,7 +247,7 @@ export class SearchMapComponent extends Component {
? withCoordinatesObfuscated(listingsWithLocation)
: listingsWithLocation;
const isMapsLibLoaded = window.google && window.google.maps;
const isMapsLibLoaded = typeof window !== 'undefined' && window.google && window.google.maps;
// container element listens clicks so that opened SearchMapInfoCard can be closed
/* eslint-disable jsx-a11y/no-static-element-interactions */