remove fetch api - we don't want no polyfills, and already have jQuery
This commit is contained in:
parent
045bd3fd73
commit
0a0ff2fdab
1 changed files with 9 additions and 7 deletions
|
@ -1,17 +1,19 @@
|
||||||
|
/* global $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Metamaps.Backbone
|
* Dependencies:
|
||||||
|
* Metamaps.Backbone
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Mapper = {
|
const Mapper = {
|
||||||
// this function is to retrieve a mapper JSON object from the database
|
// this function is to retrieve a mapper JSON object from the database
|
||||||
// @param id = the id of the mapper to retrieve
|
// @param id = the id of the mapper to retrieve
|
||||||
get: function (id, callback) {
|
get: function (id, callback) {
|
||||||
return fetch(`/users/${id}.json`, {
|
$.ajax({
|
||||||
}).then(response => {
|
url: `/users/${id}.json`,
|
||||||
if (!response.ok) throw response
|
success: data => {
|
||||||
return response.json()
|
callback(new Metamaps.Backbone.Mapper(data))
|
||||||
}).then(payload => {
|
}
|
||||||
callback(new Metamaps.Backbone.Mapper(payload))
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue