Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help ---Redux offline #550

Open
nitesh047 opened this issue Oct 19, 2023 · 0 comments
Open

Help ---Redux offline #550

nitesh047 opened this issue Oct 19, 2023 · 0 comments

Comments

@nitesh047
Copy link

I am using redux offline, and it is working correctly. But the problem is that when I make an API request offline and then come online in a few minutes, the API gets called, but if I don't come online for several hours, it doesn't call.
My config is ---

import {createStore, applyMiddleware, compose} from 'redux';
import thunk from 'redux-thunk';
import {persistStore, persistReducer} from 'redux-persist';
import reducers from './reducers';
import {offline} from '@redux-offline/redux-offline';
import offlineConfig from '@redux-offline/redux-offline/lib/defaults';
import AsyncStorage from '@react-native-async-storage/async-storage';

const customConfig = {
  ...offlineConfig,
  retry: neverRetry,
};

function neverRetry(action, attemptNumber) {
  return 1000 * Math.pow(2, attemptNumber)
}
 
export const store = createStore(
  reducers,
  {},
  compose(applyMiddleware(thunk), offline(customConfig)),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant