mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
var Reflux = require("reflux");
|
|
var Server = require('./FeatureToggleServerFacade');
|
|
|
|
var FeatureToggleActions = Reflux.createActions({
|
|
'create': { asyncResult: true },
|
|
'update': { asyncResult: true },
|
|
'archive': { asyncResult: true },
|
|
'revive': { asyncResult: true }
|
|
});
|
|
|
|
FeatureToggleActions.create.listen(function(feature){
|
|
Server.createFeature(feature, function(error) {
|
|
if(error) {
|
|
this.failed(error);
|
|
} else {
|
|
this.completed(feature);
|
|
}
|
|
}.bind(this));
|
|
});
|
|
|
|
FeatureToggleActions.update.listen(function(feature){
|
|
Server.updateFeature(feature, function(error) {
|
|
if(error) {
|
|
this.failed(error);
|
|
} else {
|
|
this.completed(feature);
|
|
}
|
|
}.bind(this));
|
|
});
|
|
|
|
FeatureToggleActions.archive.listen(function(feature){
|
|
Server.archiveFeature(feature, function(error) {
|
|
if(error) {
|
|
this.failed(error);
|
|
} else {
|
|
this.completed(feature);
|
|
}
|
|
}.bind(this));
|
|
});
|
|
|
|
FeatureToggleActions.revive.listen(function(feature){
|
|
Server.reviveFeature(feature, function(error) {
|
|
if(error) {
|
|
this.failed(error);
|
|
} else {
|
|
this.completed(feature);
|
|
}
|
|
}.bind(this));
|
|
});
|
|
|
|
module.exports = FeatureToggleActions;
|