mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
30 lines
721 B
JavaScript
30 lines
721 B
JavaScript
var Reflux = require("reflux");
|
|
var StrategyAPI = require('./StrategyAPI');
|
|
|
|
var StrategyActions = Reflux.createActions({
|
|
'create': { asyncResult: true },
|
|
'remove': { asyncResult: true },
|
|
});
|
|
|
|
StrategyActions.create.listen(function(feature){
|
|
StrategyAPI.createStrategy(feature, function(err) {
|
|
if(err) {
|
|
this.failed(err);
|
|
} else {
|
|
this.completed(feature);
|
|
}
|
|
}.bind(this));
|
|
});
|
|
|
|
StrategyActions.remove.listen(function(feature){
|
|
StrategyAPI.removeStrategy(feature, function(err) {
|
|
if(err) {
|
|
this.failed(err);
|
|
} else {
|
|
this.completed(feature);
|
|
}
|
|
}.bind(this));
|
|
});
|
|
|
|
module.exports = StrategyActions;
|