]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions/graphhopper.js
Revert "Don't pass the locale to the Mapzen routing engine"
[rails.git] / app / assets / javascripts / index / directions / graphhopper.js
index 5a16f708cf33916a5ba1eccc7cd069b54c6b4eac..c35085b35482fcbf336a7dd76c96522675affbb2 100644 (file)
@@ -21,7 +21,7 @@ function GraphHopperEngine(id, vehicleType) {
       // GraphHopper Directions API documentation
       // https://github.com/graphhopper/directions-api/blob/master/docs-routing.md
       return $.ajax({
-        url: document.location.protocol + "//graphhopper.com/api/1/route",
+        url: document.location.protocol + OSM.GRAPHHOPPER_URL,
         data: {
           vehicle: vehicleType,
           locale: I18n.currentLocale(),
@@ -58,12 +58,15 @@ function GraphHopperEngine(id, vehicleType) {
             ]); // TODO does graphhopper map instructions onto line indices?
           }
 
-          callback(null, {
+          callback(false, {
             line: line,
             steps: steps,
             distance: path.distance,
             time: path.time / 1000
           });
+        },
+        error: function () {
+          callback(true);
         }
       });
     }