Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else if (attempts === 4) {
params = {
country: props.country,
format: 'json',
};
}
// need to change map zoom depending on the number of attempts
const mapSize = {
1: 14,
2: 10,
3: 10,
4: 5,
};
Rest
.get(
`${window.location.protocol}//nominatim.openstreetmap.org/search`,
params
)
.end((err, res) => {
if (!err && res.ok && res.body && res.body[0]) {
const place = res.body[0];
this.setState(
{ latitude: place.lat, longitude: place.lon, busy: false },
this.setMap.bind(this, mapSize[attempts])
);
} else if (attempts < 4) {
this.getGeocode(props, ++attempts);
} else {
console.log('!!! geocode response error', err, res);
if (this.state.map) {
_getREST: function(request) {
console.log('!!! RestWatch _getREST');
request.pollBusy = true;
Rest.get(request.url, request.params)
.end(function(err, res) {
console.log('!!! RestWatch end', err, res);
if (err) {
throw err;
}
if (res.ok) {
request.handler(res.body);
}
request.pollBusy = false;
});
},
_onDeleteResponse: function (err, res) {
if (err) {
throw err;
}
if (res.ok) {
Rest.get(res.body.taskUri).end(this._onTaskResponse);
}
},
Object.keys(config.scopes).map(function (key) {
var scope = config.scopes[key];
if (scope.ou !== this.props.scope.ou) {
params.base = encodeURIComponent('ou=' + scope.ou + ',o=' + config.organization);
params.filter = encodeURIComponent(scope.filterForSearch(searchText));
params.attributes = config.attributesFromSchema(scope.schema);
Rest.get('/ldap/', params).end(function (err, res) {
this._onSearchResponse(scope, err, res);
}.bind(this));
}
}.bind(this));
}.bind(this), 200);
_getData: function () {
Rest.get(this.state.uri).end(this._onGetResponse);
},
_getData: function () {
Rest.get(this.state.uri).end(this._onGetResponse);
},
return function (dispatch) {
dispatch({ type: DASHBOARD_SEARCH, text: text });
if (text && text.length > 0) {
let params = {
start: 0,
count: 5,
query: text
};
Rest.get('/rest/index/search-suggestions', params).end((err, res) => {
if (err) {
throw err;
} else if (res.ok) {
dispatch({ type: DASHBOARD_SEARCH_SUCCESS, result: res.body });
}
});
}
};
}
_getData: function () {
Rest.get(this.state.uri).end(this._onResponse);
},
_getData: function () {
Rest.get(this.state.uri).end(this._onGetResponse);
},
_onNetworkSearch: function (value) {
var category;
if ('Ethernet' === this.state.connection.type) {
category = 'ethernet-networks';
} else {
category = 'fc-networks';
}
var params = {category: category, query: value,
start: 0, count: 5};
Rest.get('/rest/index/search-suggestions', params)
.end(this._onNetworkSearchResponse);
},