1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/public/js/stores/FeatureStore.js

40 lines
863 B
JavaScript
Raw Normal View History

2014-10-31 12:25:18 +01:00
var reqwest = require('reqwest');
var FeatureStore = function () {
};
var TYPE = 'json';
var CONTENT_TYPE = 'application/json';
2014-10-31 12:25:18 +01:00
FeatureStore.prototype = {
updateFeature: function (feature) {
2014-10-31 12:25:18 +01:00
return reqwest({
url: 'features/' + feature.name,
method: 'put',
type: TYPE,
contentType: CONTENT_TYPE,
data: JSON.stringify(feature)
2014-10-31 12:25:18 +01:00
});
},
createFeature: function (feature) {
return reqwest({
url: 'features',
method: 'post',
type: TYPE,
contentType: CONTENT_TYPE,
2014-10-31 12:25:18 +01:00
data: JSON.stringify(feature)
});
},
getFeatures: function () {
return reqwest({
url: 'features',
method: 'get',
type: TYPE
2014-10-31 12:25:18 +01:00
});
}
};
module.exports = FeatureStore;