react-session-control
Version:
Component to provide session control. It controls how long the user can be inactive and observes the storage checking for token existence.
20 lines (19 loc) • 862 B
TypeScript
import { PureComponent } from 'react';
export interface UnauthenticatedSessionControlProps {
/**Key do check existence in local storage. */
storageTokenKey: string;
/**The time in miliseconds to debounce token changes. */
tokenChangeDebounceTime?: number;
/**Callback to be called when token is registered on localStorage. */
onLogin: () => void;
}
export default class UnauthenticatedSessionControl extends PureComponent<UnauthenticatedSessionControlProps> {
static defaultProps: Partial<UnauthenticatedSessionControlProps>;
handleStorageKeyChangeDebounced: any;
constructor(props: UnauthenticatedSessionControlProps);
componentDidMount(): void;
componentWillUnmount(): void;
handleStorageChange(event: any): void;
handleStorageKeyChange({ newValue }: any): void;
render(): boolean;
}