mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-01 00:08:27 +01:00
981c383bb5
Closes #47.
40 lines
946 B
JavaScript
40 lines
946 B
JavaScript
var reqwest = require('reqwest');
|
|
|
|
var FeatureStore = function () {
|
|
};
|
|
|
|
FeatureStore.TYPE = 'json';
|
|
FeatureStore.CONTENT_TYPE = 'application/json';
|
|
|
|
FeatureStore.prototype = {
|
|
updateFeature: function (feature) {
|
|
return reqwest({
|
|
url: 'features/' + feature.name,
|
|
method: 'put',
|
|
type: FeatureStore.TYPE,
|
|
contentType: FeatureStore.CONTENT_TYPE,
|
|
data: JSON.stringify(feature)
|
|
});
|
|
},
|
|
|
|
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;
|