From 0a0ff2fdab38c44a0367598eb1e449b42776449f Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 24 Sep 2016 23:28:11 +0800 Subject: [PATCH] remove fetch api - we don't want no polyfills, and already have jQuery --- frontend/src/Metamaps/Mapper.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/frontend/src/Metamaps/Mapper.js b/frontend/src/Metamaps/Mapper.js index 3858101d..70cbd81a 100644 --- a/frontend/src/Metamaps/Mapper.js +++ b/frontend/src/Metamaps/Mapper.js @@ -1,17 +1,19 @@ +/* global $ */ + /* - * Metamaps.Backbone + * Dependencies: + * Metamaps.Backbone */ const Mapper = { // this function is to retrieve a mapper JSON object from the database // @param id = the id of the mapper to retrieve get: function (id, callback) { - return fetch(`/users/${id}.json`, { - }).then(response => { - if (!response.ok) throw response - return response.json() - }).then(payload => { - callback(new Metamaps.Backbone.Mapper(payload)) + $.ajax({ + url: `/users/${id}.json`, + success: data => { + callback(new Metamaps.Backbone.Mapper(data)) + } }) } }