2015-03-03 19:27:17 +01:00
|
|
|
var Reflux = require("reflux");
|
2015-03-16 21:27:56 +01:00
|
|
|
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;
|