need your help here.
I'm trying to use redux-toolkit with redux-offline. My issue is that I need to find a solution to call asyncthunk from redux-offline's "effect".
Ideally it should be :
dispatch({
type: 'someOfflineAction',
meta: {
offline: {
effect: { func: asyncThunkFunc, args: payload}
}
}
});
// from redux-offline custom config
const effect = ({ func, args}) => {
return func(args)
}
But obviously not working because functions are not serializable
I searched a way to call asyncThunk by string name (and not by import), do you guys know if it's possible ? Like :
dispatch({
type: 'someOfflineAction',
meta: {
offline: {
effect: { type: "asyncThunkName", payload}
}
}
});
// from redux-offline custom config
const effect = ({ type, payload}) => {
return store.dispatch({ type, payload })
}
I'm using createSlice by the way.
Or maybe you have other solutions to suggest ?
Thanks and have a nice day.