Skip to content

Commit

Permalink
Merge pull request #290 from kabalin/fix-admin-region-check
Browse files Browse the repository at this point in the history
Fix error when Nominatim region check was aborted.
  • Loading branch information
aeifn authored Nov 19, 2020
2 parents 260add9 + 76f6f9d commit 02227b8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions public/js/module/admin/regionCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,14 @@ define([
updateRegionAbort: function () {
if (this.ownRegionsDeffered) {
this.ownRegionsDeffered.reject();
this.ownRegionsDeffered = null;
}

if (this.nominatimRegionsDeffered) {
this.nominatimRegionsDeffered.reject();
this.nominatimRegionsDeffered = null;
}

if (requestNominatim) {
requestNominatim.abort();
requestNominatim = null;
}
},
updateRegion: function (geo) {
Expand Down Expand Up @@ -257,14 +254,21 @@ define([
'&accept-language=' + P.settings.lang,
{
crossDomain: true,

dataType: 'json',
cache: false,
context: this,
}
);
requestNominatim
.fail(function (jqXHR, textStatus, errorThrown) {
if (jqXHR.responseJSON.hasOwnProperty('error')) {
if (textStatus === 'abort') {
// We must have clicked before previous request
// finished.
return;
}

if (jqXHR.responseJSON && jqXHR.responseJSON.hasOwnProperty('error')) {
tplObj.narr.push({ 'err': jqXHR.responseJSON.error.message });
console.warn('Error: ' + jqXHR.responseText);
} else {
Expand Down

0 comments on commit 02227b8

Please sign in to comment.