redux-idle-timeout-monitor
v1.0.1
Published
This middle-ware allows to monitor ideal timeout in redux application.
Downloads
209
Maintainers
Readme
redux-idle-timeout-monitor
Redux middleware for monitoring user's idle timeout on application.
Using this middleware you can do followup functionality on timeout because this middleware will dispatch action (ex. autoLogout) that you pass at the time of configuration, So your app can handle that and do respective functionality like clear session or logout the app etc.
Usage
import { createStore, applyMiddleware } from 'redux';
import createIdleMonitorReduxMiddleware from 'redux-idle-timeout-monitor';
// configure middleware for 10 minute timeout
const idleMonitorMiddleware = createIdleMonitorReduxMiddleware(10 * 60 * 1000, autoLogout);
export function autoLogout() {
return {
type: 'AUTO_LOGOUT',
};
}
// Add middleware
const store = createStore(
yourApp,
applyMiddleware(idleMonitorMiddleware)
);
Installation
$ npm install redux-idle-timeout-monitor
License
MIT