import { ActionSnackbar } from '@cloudbeaver/core-blocks' ; import { Bootstrap , injectable } from '@cloudbeaver/core-di' ; import { CommonDialogService , DialogueStateResult } from '@cloudbeaver/core-dialogs' ; import { ENotificationType , NotificationService } from '@cloudbeaver/core-events' ; import { SessionExpireService } from '@cloudbeaver/core-root' ; import { SessionExpiredDialog } from './SessionExpiredDialog' ; @ injectable ( ) export class SessionExpiredDialogService extends Bootstrap { constructor ( private notificationService , private commonDialogService , private sessionExpireService ) { super ( ) ; } register ( ) { this . sessionExpireService . onSessionExpire . addHandler ( this . handleSessionExpired . bind ( this ) ) ; } load ( ) { } private async handleSessionExpired ( ) { const state = await this . commonDialogService . open ( SessionExpiredDialog , null ) ; if ( state === DialogueStateResult . Rejected ) { this . notificationService . customNotification ( ( ) => ActionSnackbar , { actionText : 'app_root_session_expired_reload' , onAction : ( ) => location . reload ( ) , } , { title : 'app_root_session_expired_title' , persistent : true , type : ENotificationType . Error } ) ; } } }