X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/b7eb7d60846333d93e91f98ec3e6fcdd94fca570..55c0fe472ca9938c93a78bbff0e0fb1b5e51a54e:/src/views-components/auto-logout/auto-logout.tsx diff --git a/src/views-components/auto-logout/auto-logout.tsx b/src/views-components/auto-logout/auto-logout.tsx index f7e6f4b8..b4bef2b5 100644 --- a/src/views-components/auto-logout/auto-logout.tsx +++ b/src/views-components/auto-logout/auto-logout.tsx @@ -6,11 +6,11 @@ import { connect } from "react-redux"; import { useIdleTimer } from "react-idle-timer"; import { Dispatch } from "redux"; -import { RootState } from "~/store/store"; -import { SnackbarKind, snackbarActions } from "~/store/snackbar/snackbar-actions"; -import { logout } from "~/store/auth/auth-action"; +import { RootState } from "store/store"; +import { SnackbarKind, snackbarActions } from "store/snackbar/snackbar-actions"; +import { logout } from "store/auth/auth-action"; import parse from "parse-duration"; -import * as React from "react"; +import React from "react"; import { min } from "lodash"; interface AutoLogoutDataProps { @@ -30,7 +30,7 @@ const mapStateToProps = (state: RootState, ownProps: any): AutoLogoutDataProps = }); const mapDispatchToProps = (dispatch: Dispatch): AutoLogoutActionProps => ({ - doLogout: () => dispatch(logout(true)), + doLogout: () => dispatch(logout(true, true)), doWarn: (message: string, duration: number) => dispatch(snackbarActions.OPEN_SNACKBAR({ message, hideDuration: duration, kind: SnackbarKind.WARNING })), @@ -40,7 +40,7 @@ const mapDispatchToProps = (dispatch: Dispatch): AutoLogoutActionProps => ({ export type AutoLogoutProps = AutoLogoutDataProps & AutoLogoutActionProps; const debounce = (delay: number | undefined, fn: Function) => { - let timerId: number | null; + let timerId: NodeJS.Timer | null; return (...args: any[]) => { if (timerId) { clearTimeout(timerId); } timerId = setTimeout(() => { @@ -63,7 +63,7 @@ export const AutoLogoutComponent = (props: AutoLogoutProps) => { return () => { window.removeEventListener('storage', handleStorageEvents); }; - }, []); + }); const handleStorageEvents = (e: StorageEvent) => { if (e.key === LAST_ACTIVE_TIMESTAMP) { @@ -90,7 +90,7 @@ export const AutoLogoutComponent = (props: AutoLogoutProps) => { const handleOnAction = () => { // Notify the other tabs there was some activity. - const now = (new Date).getTime(); + const now = (new Date()).getTime(); localStorage.setItem(LAST_ACTIVE_TIMESTAMP, now.toString()); };