Last active
October 2, 2017 17:01
-
-
Save mattduggan/bc9f4bbe470f533c629cecb0301363da to your computer and use it in GitHub Desktop.
Feature Tour - Actions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
this.FeatureTourActions = function() { | |
var Constants = Yesware.get("FeatureTourConstants"); | |
var Service = Yesware.get("FeatureTourService"); | |
var Dispatcher = Yesware.get("EventDispatcher"); | |
return { | |
getList: function() { | |
Dispatcher.trigger(Constants.GET_FEATURE_TOURS); | |
return Service | |
.getFeatureTours() | |
.then(function(featureTours) { | |
Dispatcher.trigger(Constants.GET_FEATURE_TOURS_SUCCESS, featureTours); | |
return featureTours; | |
}) | |
.catch(function(reason) { | |
Dispatcher.trigger(Constants.GET_FEATURE_TOURS_ERROR, reason); | |
throw reason; | |
}); | |
}, | |
put: function(featureTour) { | |
Dispatcher.trigger(Constants.PUT_FEATURE_TOUR); | |
return Service | |
.getFeatureTours() | |
.then(function(featureTour) { | |
Dispatcher.trigger(Constants.PUT_FEATURE_TOUR_SUCCESS, featureTour); | |
return featureTour; | |
}) | |
.catch(function(reason) { | |
Dispatcher.trigger(Constants.PUT_FEATURE_TOUR_ERROR, reason); | |
throw reason; | |
}); | |
} | |
}; | |
}; | |
}).apply(Yesware); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment