diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.html index 35793d93..712babdf 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.html @@ -124,13 +124,6 @@ - + diff --git a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts index b387358c..1ebe5c2f 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.ts @@ -34,7 +34,10 @@ import { KEY_LOGIN_INFO, KEY_VER_INFO, EnvironmentsInfo, - KEY_ENVIRONMENTS_INFO + KEY_ENVIRONMENTS_INFO, + KEY_LOGIN_RES_INFO, + KEY_LOGOUT_INFO, + KEY_AUTH_INFO } from '@app/types'; import { WebLink, @@ -62,7 +65,12 @@ import { ProfileDialogResult, ProfileDialogData } from '@app/layouts/messenger/dialogs/profile/profile.dialog.component'; -import { DialogService } from '@ucap-webmessenger/ui'; +import { + DialogService, + ConfirmDialogComponent, + ConfirmDialogData, + ConfirmDialogResult +} from '@ucap-webmessenger/ui'; import { DOCUMENT } from '@angular/common'; import { MatMenu, MatMenuTrigger } from '@angular/material/menu'; import { StatusCode, StatusType, WindowUtil } from '@ucap-webmessenger/core'; @@ -663,4 +671,31 @@ export class TopBarComponent implements OnInit, OnDestroy { this.integratedSearchWord = ''; } + + async onClickClearSettingAndLogout() { + const result = await this.dialogService.open< + ConfirmDialogComponent, + ConfirmDialogData, + ConfirmDialogResult + >(ConfirmDialogComponent, { + width: '400px', + data: { + title: 'Clear & Logout?', + html: 'Clear General Setting And Logout?' + } + }); + + if (!!result && !!result.choice && result.choice) { + this.localStorageService.remove(KEY_APP_USER_INFO); + this.sessionStorageService.remove(KEY_LOGIN_RES_INFO); + this.sessionStorageService.remove(KEY_VER_INFO); + this.sessionStorageService.remove(KEY_LOGIN_INFO); + this.sessionStorageService.remove(KEY_URL_INFO); + this.sessionStorageService.remove(KEY_AUTH_INFO); + this.sessionStorageService.remove(KEY_LOGOUT_INFO); + this.nativeService.clearAppStorage(); + this.dialogService.closeAll(); + this.store.dispatch(AuthenticationStore.loginRedirect()); + } + } }