kickstartcrew / redux-offline-queue

Simple offline queue for redux. Queue actions while offline to dispatch the requests upon connectivity.
Other
136 stars 17 forks source link

Using plain actions for offline queue #15

Closed sharathchandramg closed 6 years ago

sharathchandramg commented 6 years ago

Hi, I was just trying to get the basic app running. I am not using redux-sauce and instead using plain objects for actions.

e.g.

export function getFormData(templateId, instanceId) {
    return {
        type: types.GET_FORM_DATA_REQUEST,
        payload: {
            templateId: templateId,
            instanceId: instanceId,
        }
    }
}

How can I mark these actions under maskActionOffline?

RobPando commented 6 years ago

@sharathchandramg Hey, you have to pass to markActionOffline an initial object param containing your actions you want to queue. For your case you would do something like:

const Creators = {
  getFormData, // using object literal shorthand
}

markActionsOffline(Creators, ['getFormData'])

or simply markActionsOffline({ getFormData }, ['getFormData']) if you are only going to ever have one.