remove fetch api - we don't want no polyfills, and already have jQuery

This commit is contained in:
Devin Howard 2016-09-24 23:28:11 +08:00
parent 045bd3fd73
commit 0a0ff2fdab

View file

@ -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))
}
})
}
}