purgeStoredState.js 560 B

123456789101112131415161718
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = purgeStoredState;
  4. var _constants = require("./constants");
  5. function purgeStoredState(config) {
  6. var storage = config.storage;
  7. var storageKey = "".concat(config.keyPrefix !== undefined ? config.keyPrefix : _constants.KEY_PREFIX).concat(config.key);
  8. return storage.removeItem(storageKey, warnIfRemoveError);
  9. }
  10. function warnIfRemoveError(err) {
  11. if (err && process.env.NODE_ENV !== 'production') {
  12. console.error('redux-persist/purgeStoredState: Error purging data stored state', err);
  13. }
  14. }