Closed ViniciusCrisol closed 4 years ago
@ViniciusCrisol I need to update the readme but basically if you are using pure redux I would imagine you have an actions
folder with all your action files. in any action file you need to do something like this
import { createOfflineActions } from "redux-offline-queue";
const { Types, Creators } = createOfflineActions({
myOfflineActionRequest: ["param1", "param2"]
})
export const OfflineMyStoreTypes = Types;
export const OfflineMyStoreCreators = Creators;
and you should listen to this type for actions so in your redux saga or reducers you would import the type and the constant is the name of the action but snake case and all caps like you would a normal constant
import { OfflineMyStoreTypes } from "./actions/myStore";
....
case OfflineMyStoreTypes.MY_OFFLINE_ACTION_REQUEST: ....
and in your react components where you will dispatch the actions you would import the creator
import { OfflineMyStoreCreators } from "../redux/actions/myStore";
...
const mapDispatchToProps = (dispatch) => ({
myRequest: (param1, param2) => dispatch(OfflineMyStoreCreator.myOfflineRequest(param1, param2),
})
NOTE: That for all other actions you make where you don't need offline queue you don't need to odd them in the createOfflineActions
method but outside and normally as you would do without it.
markActionsOffline is not working, I think this is wrong, I'm searching, but I didn't find anything