]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/new_note.js
Move OAuth requests to fetch
[rails.git] / app / assets / javascripts / index / new_note.js
index a1511a3bc14b6184bb5777bb718e2ae9e22f478c..6b24be07d28a20e6eebd37ed960d85667af7cd93 100644 (file)
@@ -34,17 +34,17 @@ OSM.NewNote = function (map) {
   });
 
   function createNote(location, text, callback) {
-    $.ajax({
-      url: "/api/0.6/notes.json",
-      type: "POST",
-      oauth: true,
-      data: {
+    fetch("/api/0.6/notes.json?", {
+      method: "POST",
+      headers: { ...OSM.oauth },
+      body: new URLSearchParams({
         lat: location.lat,
         lon: location.lng,
         text
-      },
-      success: callback
-    });
+      })
+    })
+      .then(response => response.json())
+      .then(callback);
   }
 
   function addCreatedNoteMarker(feature) {