These are chat archives for reflux/refluxjs

7th
May 2015
Alex Castaño
@alexcastano
May 07 2015 15:03
Hello, who is suppose to do an ajax call in a reflux, an action or a store? It feels better in the action, however the action needs more information to some requests. On the other hand if I add to the store it seems very messy adding to many responsibilities for one class.
vogrelord
@vogrelord
May 07 2015 16:23
From what I understood, the ajax promise should be called in preEmit property of the reflux action
vogrelord
@vogrelord
May 07 2015 16:30

Actually in my project I wrote a wrapper for it and my action definitions look like this:

 ANALYTICS_START_REPORT: createAction('ANALYTICS_START_REPORT', {
        promise: AnalyticsApi.startReport,
        shouldEmit: ()=>{return Ag3PermissionChecker.checkDownloadAnalyticReport()},
        // type validation
        params: {
            deal_id: {
                type: 'number',
                required: true
            }
        }
    }),

which creates an async actions, that does listenAndPromise , and make some checks