No need to observe

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-08-20 22:53:15 +05:30
parent a5985cba2a
commit 0630452571

View file

@ -40,10 +40,9 @@ export class RootViewModel extends ViewModel {
} }
async _applyNavigation(shouldRestoreLastUrl) { async _applyNavigation(shouldRestoreLastUrl) {
const isLogin = this.navigation.observe("login").get(); const isLogin = this.navigation.path.get("login")
const sessionId = this.navigation.observe("session").get(); const sessionId = this.navigation.path.get("session")?.value;
// TODO: why not observe? const loginToken = this.navigation.path.get("sso")?.value;
const ssoSegment = this.navigation.path.get("sso");
if (isLogin) { if (isLogin) {
if (this.activeSection !== "login") { if (this.activeSection !== "login") {
this._showLogin(); this._showLogin();
@ -68,10 +67,10 @@ export class RootViewModel extends ViewModel {
this._showSessionLoader(sessionId); this._showSessionLoader(sessionId);
} }
} }
} else if (ssoSegment) { } else if (loginToken) {
this.urlCreator.normalizeUrl(); this.urlCreator.normalizeUrl();
if (this.activeSection !== "login") { if (this.activeSection !== "login") {
this._showLogin({loginToken: ssoSegment.value}); this._showLogin(loginToken);
} }
} }
else { else {
@ -120,7 +119,7 @@ export class RootViewModel extends ViewModel {
this._pendingSessionContainer = sessionContainer; this._pendingSessionContainer = sessionContainer;
this.navigation.push("session", sessionContainer.sessionId); this.navigation.push("session", sessionContainer.sessionId);
}, },
...loginToken loginToken
})); }));
}); });
} }