How to use the redux-persist.purgeStoredState function in redux-persist

To help you get started, we’ve selected a few redux-persist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flekschas / hipiler / src / services / states.js View on Github external
reset () {
    // Reset state to default values
    this.store.dispatch(resetState());

    // Clear history
    this.store.dispatch(ActionCreators.clearHistory());

    // Purge persistent store
    return purgeStoredState(CONFIG);
  }
}
github l3wi / iotaMobile / app / actions / iota.js View on Github external
return async (dispatch, getState) => {
    purgeStoredState({ storage: AsyncStorage }, [])
      .then(() => {
        console.log("purge of someReducer completed");
        DeleteBox("seed");
        navigator.resetTo({
          screen: "auth"
        });
        Alert.alert("Seed & Local data was destroyed");
      })
      .catch(() => {
        console.log("purge of someReducer failed");
      });
  };
};
github iotaledger / trinity-wallet / src / shared / migrations.js View on Github external
const purgeBeforePersist = (restoredState, state, config, cb) =>
    purgeStoredState({ storage: config.storage })
        .then(() => {
            const incomingState = state.getState();

            const updatedState = updateSafely(incomingState, restoredState, config.blacklist);

            const persistor = createPersistor(state, config);
            persistor.rehydrate(updatedState);

            return persistState(state, config, cb);
        })
        .catch(() => persistState(state, config, cb));
github jasonhealy / react-native-typescript-starter / src / containers / screens / counter.tsx View on Github external
public clearCache(): void {
    purgeStoredState({storage: AsyncStorage});
  }