- var remoteEditHost = "http://127.0.0.1:8111",
- osmHost = location.protocol + "//" + location.host,
- query = {
- left: bbox.getWest() - 0.0001,
- top: bbox.getNorth() + 0.0001,
- right: bbox.getEast() + 0.0001,
- bottom: bbox.getSouth() - 0.0001
- };
-
- if (object && object.type !== "note") query.select = object.type + object.id; // can't select notes
- sendRemoteEditCommand(remoteEditHost + "/load_and_zoom?" + Qs.stringify(query), function () {
- if (object && object.type === "note") {
- var noteQuery = { url: osmHost + OSM.apiUrl(object) };
- sendRemoteEditCommand(remoteEditHost + "/import?" + Qs.stringify(noteQuery));
- }
- });
+ const remoteEditHost = "http://127.0.0.1:8111",
+ osmHost = location.protocol + "//" + location.host,
+ query = new URLSearchParams({
+ left: bbox.getWest() - 0.0001,
+ top: bbox.getNorth() + 0.0001,
+ right: bbox.getEast() + 0.0001,
+ bottom: bbox.getSouth() - 0.0001
+ });
+
+ if (object && object.type !== "note") query.set("select", object.type + object.id); // can't select notes
+ sendRemoteEditCommand(remoteEditHost + "/load_and_zoom?" + query)
+ .then(() => {
+ if (object && object.type === "note") {
+ const noteQuery = new URLSearchParams({ url: osmHost + OSM.apiUrl(object) });
+ sendRemoteEditCommand(remoteEditHost + "/import?" + noteQuery);
+ }
+ })
+ .catch(() => {
+ // eslint-disable-next-line no-alert
+ alert(I18n.t("site.index.remote_failed"));
+ });