Skip to content

gabceb/redux-persist-transform-expire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redux-persist-transform-expire

npm

Add expiration to your persisted store.

Usage

import createExpirationTransform from 'redux-persist-transform-expire';

const expireTransform = createExpirationTransform({
  expireKey: 'customExpiresAt',
  defaultState: {
    custom: 'values'
  }
});

persistStore(store, {
  transforms: [expireTransform]
});

Your expires key should be present in each reducer, which should be expired. E.g.

// top most reducer
{
  reducerOne: {
    persistExpiresAt: '2017-04-11T15:46:54.338Z'
  },
  reducerTwo: {
    persistExpiresAt: '2017-04-11T15:46:54.338Z'
  }
}

Configuration

Attr Type Default Notes
expireKey String 'persistExpiresAt' Name of the attribute holding the expire date value
defaultState Any {} Shape of the state after expirations happen

About

Add expiration to your persisted store

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •