From 55218624984956ff8f72a2c764e9ca0ac1b27872 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Wed, 24 Aug 2022 16:03:00 +0530 Subject: [PATCH] Use forced segment inside logout --- src/domain/RootViewModel.js | 12 ++++++------ src/domain/navigation/index.ts | 8 ++++---- src/domain/session/SessionViewModel.js | 7 ++++++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/domain/RootViewModel.js b/src/domain/RootViewModel.js index c13f7ce6..8e74244b 100644 --- a/src/domain/RootViewModel.js +++ b/src/domain/RootViewModel.js @@ -40,28 +40,28 @@ export class RootViewModel extends ViewModel { this.track(this.navigation.observe("login").subscribe(() => this._applyNavigation())); this.track(this.navigation.observe("session").subscribe(() => this._applyNavigation())); this.track(this.navigation.observe("sso").subscribe(() => this._applyNavigation())); - this.track(this.navigation.observe("forced-logout").subscribe(() => this._applyNavigation())); + this.track(this.navigation.observe("logout").subscribe(() => this._applyNavigation())); this._applyNavigation(true); } async _applyNavigation(shouldRestoreLastUrl) { const isLogin = this.navigation.path.get("login"); const logoutSessionId = this.navigation.path.get("logout")?.value; - const forcedLogoutSessionId = this.navigation.path.get("forced-logout")?.value; + const isForcedLogout = this.navigation.path.get("forced")?.value; const sessionId = this.navigation.path.get("session")?.value; const loginToken = this.navigation.path.get("sso")?.value; if (isLogin) { if (this.activeSection !== "login") { this._showLogin(); } + } else if (logoutSessionId && isForcedLogout) { + if (this.activeSection !== "forced-logout") { + this._showForcedLogout(logoutSessionId); + } } else if (logoutSessionId) { if (this.activeSection !== "logout") { this._showLogout(logoutSessionId); } - } else if (forcedLogoutSessionId) { - if (this.activeSection !== "forced-logout") { - this._showForcedLogout(forcedLogoutSessionId); - } } else if (sessionId === true) { if (this.activeSection !== "picker") { this._showPicker(); diff --git a/src/domain/navigation/index.ts b/src/domain/navigation/index.ts index c1fbee13..849d870a 100644 --- a/src/domain/navigation/index.ts +++ b/src/domain/navigation/index.ts @@ -23,7 +23,7 @@ export type SegmentType = { "session": string | boolean; "sso": string; "logout": true; - "forced-logout": true; + "forced": true; "room": string; "rooms": string[]; "settings": true; @@ -49,9 +49,7 @@ function allowsChild(parent: Segment | undefined, child: Segment | undefined, child: Segment