2016-09-24 23:28:11 +08:00
|
|
|
/* global $ */
|
|
|
|
|
2016-10-02 22:28:00 +08:00
|
|
|
import DataModel from './DataModel'
|
2016-04-14 13:54:19 +08:00
|
|
|
|
2016-09-22 15:21:59 +08:00
|
|
|
const Mapper = {
|
2016-04-14 13:54:19 +08: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) {
|
2016-09-24 23:28:11 +08:00
|
|
|
$.ajax({
|
|
|
|
url: `/users/${id}.json`,
|
|
|
|
success: data => {
|
2016-10-02 22:28:00 +08:00
|
|
|
callback(new DataModel.Mapper(data))
|
2016-09-24 23:28:11 +08:00
|
|
|
}
|
2016-04-14 13:54:19 +08:00
|
|
|
})
|
|
|
|
}
|
2016-09-22 15:21:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export default Mapper
|