Skip to content
Snippets Groups Projects
Commit e7ab9e49 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

fix google api changes

parent 53f1f5e9
No related branches found
No related tags found
No related merge requests found
...@@ -126,23 +126,23 @@ angular.module('cesium.es.geo.services', ['cesium.services', 'cesium.es.http.ser ...@@ -126,23 +126,23 @@ angular.module('cesium.es.geo.services', ['cesium.services', 'cesium.es.http.ser
}); });
} }
// If no google api key in config: get it from settings
that.raw.google.apiKey = csConfig.plugins && csConfig.plugins.es && csConfig.plugins.es.googleApiKey; that.raw.google.apiKey = csConfig.plugins && csConfig.plugins.es && csConfig.plugins.es.googleApiKey;
if (!that.raw.google.apiKey) { var hasConfigApiKey = !!that.raw.google.apiKey;
csSettings.ready() csSettings.ready()
.then(function() { .then(function() {
// Listen settings changed // Listen settings changed
function onSettingsChanged(data){ function onSettingsChanged(data){
that.raw.google.enable = data.plugins && data.plugins.es && data.plugins.es.enableGoogleApi; if (!hasConfigApiKey) {
that.raw.google.apiKey = that.raw.google.enable && data.plugins.es.googleApiKey; // If no google api key in config, use in settings
that.raw.google.apiKey = data.plugins.es.googleApiKey;
}
that.raw.google.enable = that.raw.google.apiKey && data.plugins && data.plugins.es && data.plugins.es.enableGoogleApi;
} }
csSettings.api.data.on.changed($rootScope, onSettingsChanged, this); csSettings.api.data.on.changed($rootScope, onSettingsChanged, this);
onSettingsChanged(csSettings.data); onSettingsChanged(csSettings.data);
}); });
}
return { return {
point: { point: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment