/
vshmidt
/
cloudbeaver
Обзор
Документация
Войти
/
vshmidt
/
cloudbeaver
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
devel
webapp/packages/plugin-authentication/src/UserLoadingErrorDialogBootstrap.ts
41 строка
2 KB
Dmitrii Barnukov
dbeaver/pro#6509 Query confirmations (#3793)
28 окт 2025, 16:35
Не верифицирован
28 окт 2025, 16:35
2a107f3
Код
Авторство
О чём код?
/* * CloudBeaver - Cloud Database Manager * Copyright (C) 2020-2025 DBeaver Corp and others * * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ import { UserInfoResource } from '@cloudbeaver/core-authentication'; import { ConfirmationDialog } from '@cloudbeaver/core-blocks'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { CommonDialogService, DialogueStateResult } from '@cloudbeaver/core-dialogs'; import { NotificationService } from '@cloudbeaver/core-events'; @injectable(() => [UserInfoResource, CommonDialogService, NotificationService]) export class UserLoadingErrorDialogBootstrap extends Bootstrap { constructor( private readonly userInfoResource: UserInfoResource, private readonly commonDialogService: CommonDialogService, private readonly notificationService: NotificationService, ) { super(); this.handleException = this.handleException.bind(this); userInfoResource.onException.addHandler(this.handleException); } private async handleException(exception: Error) { this.notificationService.logException(exception, 'plugin_authentication_user_loading_error'); const { status } = await this.commonDialogService.open(ConfirmationDialog, { title: 'plugin_authentication_loading_error_dialog_title', message: 'plugin_authentication_loading_error_dialog_message', }); if (status === DialogueStateResult.Resolved) { await this.userInfoResource.logout(); } } protected override dispose(): Promise<void> | void { this.userInfoResource.onException.removeHandler(this.handleException); } }