kea-react
Version:
Componentes comunes de react
17 lines (16 loc) • 756 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var http_1 = require("./http");
function crud(url, key) {
if (key === void 0) { key = "IdRegistro"; }
var urlId = function (id) { return url + "/" + id; };
var ret = {
query: function () { return http_1.Http.Get(url).then(function (x) { return x; }); },
get: function (id) { return http_1.Http.Get(urlId(id)).then(function (x) { return x; }); },
delete: function (id) { return http_1.Http.Delete(urlId(id)); },
post: function (x) { return http_1.Http.Post(url, x).then(function (x) { return x; }); },
put: function (x) { return http_1.Http.Put(urlId(x[key]), x); }
};
return ret;
}
exports.crud = crud;