Skip to content

Instantly share code, notes, and snippets.

@jstclair
Created March 25, 2015 08:16
Show Gist options
  • Save jstclair/60a8b4a7c9f3cb693507 to your computer and use it in GitHub Desktop.
Save jstclair/60a8b4a7c9f3cb693507 to your computer and use it in GitHub Desktop.
analytics-in-flux
loadOneAction(context, payload, done) {
//NOTE: This really requires a check that loadAll has completed.
// So something like context.ensure('LOAD_BOOKPILES_SUCCESS')...
//NOTE: called from the router, so route info is passed on .params
return loadData(function(err) {
console.log(err);
context.dispatch('LOAD_BOOKPILES_ERROR', {});
return done(err);
}, function(res) {
context.dispatch('LOAD_BOOKPILES_SUCCESS', res.body);
context.dispatch('SHOW_PILE', payload.params); // userid, pileid
if (IS_CLIENT) {
analytics.page(payload.params.pileid);
}
return done();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment