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

63 lines
1.4 KiB
JavaScript

var reqwest = require('reqwest');
var TYPE = 'json';
var CONTENT_TYPE = 'application/json';
FeatureStore = {
updateFeature: function (feature) {
return reqwest({
url: 'features/' + feature.name,
method: 'put',
type: TYPE,
contentType: CONTENT_TYPE,
data: JSON.stringify(feature)
});
},
createFeature: function (feature) {
return reqwest({
url: 'features',
method: 'post',
type: TYPE,
contentType: CONTENT_TYPE,
data: JSON.stringify(feature)
});
},
archiveFeature: function (feature) {
return reqwest({
url: 'features/' + feature.name,
method: 'delete',
type: TYPE
});
},
getFeatures: function () {
return reqwest({
url: 'features',
method: 'get',
type: TYPE
});
},
getArchivedFeatures: function () {
return reqwest({
url: 'archive/features',
method: 'get',
type: TYPE
});
},
reviveFeature: function (feature) {
return reqwest({
url: 'archive/revive',
method: 'post',
type: TYPE,
contentType: CONTENT_TYPE,
data: JSON.stringify(feature)
});
}
};
module.exports = FeatureStore;