metamaps--metamaps/frontend/src/Metamaps/Mapper.js

18 lines
448 B
JavaScript
Raw Normal View History

import Backbone from './Backbone'
2016-04-14 05:54:19 +00:00
const Mapper = {
2016-04-14 05:54:19 +00:00
// 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 Backbone.Mapper(payload))
2016-04-14 05:54:19 +00:00
})
}
}
export default Mapper