1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/unleash-server/public/js/stores/FeatureStore.js
2020-02-20 08:30:13 +01:00

40 lines
966 B
JavaScript

var reqwest = require('reqwest');
var FeatureStore = function () {
};
FeatureStore.TYPE = 'json';
FeatureStore.CONTENT_TYPE = 'application/json';
FeatureStore.prototype = {
updateFeature: function (changeRequest) {
return reqwest({
url: 'features/' + changeRequest.name,
method: 'patch',
type: FeatureStore.TYPE,
contentType: FeatureStore.CONTENT_TYPE,
data: JSON.stringify(changeRequest)
});
},
createFeature: function (feature) {
return reqwest({
url: 'features',
method: 'post',
type: FeatureStore.TYPE,
contentType: FeatureStore.CONTENT_TYPE,
data: JSON.stringify(feature)
});
},
getFeatures: function () {
return reqwest({
url: 'features',
method: 'get',
type: FeatureStore.TYPE
});
}
};
module.exports = FeatureStore;