Skip to content

Instantly share code, notes, and snippets.

@mattduggan
Last active October 2, 2017 17:01
Show Gist options
  • Save mattduggan/bc9f4bbe470f533c629cecb0301363da to your computer and use it in GitHub Desktop.
Save mattduggan/bc9f4bbe470f533c629cecb0301363da to your computer and use it in GitHub Desktop.
Feature Tour - Actions
(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