Skip to content

Commit 6133df2

Browse files
committed
fix after review
1 parent 09ea230 commit 6133df2

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/DGGeoclicker/src/Controller.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ DG.Geoclicker.Controller = DG.Class.extend({
3535

3636
this._renderHandlerResult = DG.bind(this._renderHandlerResult, this);
3737
this._lastHandleClickArguments = null;
38+
this._hasCatalogKey = false;
3839
},
3940

4041
handlePopupClose: function(popup) { // (Object)
@@ -70,12 +71,14 @@ DG.Geoclicker.Controller = DG.Class.extend({
7071
this._catalogApi.getLocations({
7172
latlng: latlng,
7273
zoom: zoom,
73-
beforeRequest: initShowPopup
74+
beforeRequest: initShowPopup,
75+
hasCatalogKey: this._hasCatalogKey,
7476
}).then(function(result) {
7577
if (!result['meta'] || result['meta']['code'] !== 403) {
76-
initShowPopup()
78+
initShowPopup();
79+
self._hasCatalogKey = true;
7780
}
78-
self._view._popup._closePopup()
81+
7982
self.handleResponse(result);
8083
}, function(error) {
8184
self.handleResponse(error);

src/DGGeoclicker/src/provider/CatalogApi.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DG.Geoclicker.Provider.CatalogApi = DG.Class.extend({
2020
// Callback will receive array of found results or void if errors occurred or nothing was found.
2121
var zoom = options.zoom,
2222
latlng = options.latlng,
23+
hasCatalogKey = options.hasCatalogKey,
2324
beforeRequest = options.beforeRequest || function() {},
2425
types = this.getTypesByZoom(zoom),
2526
q = latlng.lng + ',' + latlng.lat;
@@ -28,7 +29,9 @@ DG.Geoclicker.Provider.CatalogApi = DG.Class.extend({
2829
return Promise.reject('no type');
2930
}
3031

31-
beforeRequest();
32+
if (hasCatalogKey) {
33+
beforeRequest();
34+
}
3235

3336
return this.geoSearch(q, types, zoom).then(DG.bind(function(result) {
3437
return this._filterResponse(result, types);

src/DGGeoclicker/test/GeoclickerSpec.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)