inactivy tyling and time out time

This commit is contained in:
2021-12-21 14:22:50 +00:00
parent 80c437f608
commit c4ce460627
5 changed files with 90 additions and 34 deletions
+13 -14
View File
@@ -22,30 +22,26 @@ const MyPortal = (props) => {
const { locale } = router;
const [showModal, setShowModal] = useState(false);
const inactiveTimeOut = 120; // in seconds
const reminderTimeout = 30; // in seconds
let idleTimer = null;
let logoutTimer = null;
let shareState = () => {
showShareState == true
? setShowShareState(false)
: setShowShareState(true);
};
const onIdle = () => {
let onIdle = () => {
togglePopup();
logoutTimer = setTimeout(() => {
handleLogout();
}, 1000 * 5 * 1); // 5 seconds
}, 1000 * reminderTimeout * 1);
};
const togglePopup = () => {
let togglePopup = () => {
showModal == true ? setShowModal(false) : setShowModal(true);
};
const handleStayLoggedIn = () => {
let handleStayLoggedIn = () => {
if (logoutTimer) {
clearTimeout(this.logoutTimer);
clearTimeout(logoutTimer);
logoutTimer = null;
}
idleTimer.reset();
@@ -53,6 +49,7 @@ const MyPortal = (props) => {
};
const handleLogout = () => {
console.log("////////////", "\n", "logout", "\n", "//////////");
destroyCookie({}, "pinsUser"),
window.localStorage.clear(),
router.replace(props.ggLogout);
@@ -127,21 +124,23 @@ const MyPortal = (props) => {
</div>
</div>
</main>
{/* <IdleTimer
<IdleTimer
ref={(ref) => {
idleTimer = ref;
}}
element={document}
stopOnIdle={true}
onActive={console.log(" bbis active", idleTimer)}
onIdle={onIdle}
timeout={1000 * 600 * 1} // 10 seconds
timeout={1000 * inactiveTimeOut * 1}
/>
<TimeoutModal
remainingCountdown={reminderTimeout}
showModal={showModal}
togglePopup={togglePopup}
handleStayLoggedIn={handleStayLoggedIn}
/> */}
/>
</>
);
};