Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
reset () {
// Reset state to default values
this.store.dispatch(resetState());
// Clear history
this.store.dispatch(ActionCreators.clearHistory());
// Purge persistent store
return purgeStoredState(CONFIG);
}
}
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");
});
};
};
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));
public clearCache(): void {
purgeStoredState({storage: AsyncStorage});
}