зеркало из https://github.com/mozilla/CSOL-site.git
Adding some method functionality to `remote`
This commit is contained in:
Родитель
8cac79ee5c
Коммит
054b3e7067
13
api.js
13
api.js
|
@ -77,6 +77,7 @@ function apiMethod (method) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load data from remote endpoint
|
// Load data from remote endpoint
|
||||||
|
var remote = (function() {
|
||||||
function remote (method, path, callback) {
|
function remote (method, path, callback) {
|
||||||
// TODO - put this in settings somewhere
|
// TODO - put this in settings somewhere
|
||||||
var origin = 'http://openbadger-csol.mofostaging.net';
|
var origin = 'http://openbadger-csol.mofostaging.net';
|
||||||
|
@ -106,6 +107,18 @@ function remote (method, path, callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_.each(['get', 'post', 'put', 'patch', 'head', 'del'], function(method) {
|
||||||
|
Object.defineProperty(remote, method, {
|
||||||
|
enumerable: true,
|
||||||
|
value: function(path, callback) {
|
||||||
|
remote(method, path, callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return remote;
|
||||||
|
})();
|
||||||
|
|
||||||
// Make sure badges returned from remote API
|
// Make sure badges returned from remote API
|
||||||
// contain all the information we need
|
// contain all the information we need
|
||||||
function normalizeBadge (badge, id) {
|
function normalizeBadge (badge, id) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче