Show completion view on sso segment

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-07-31 17:07:44 +05:30
parent 75d71717d8
commit 4b87887a4f
2 changed files with 13 additions and 1 deletions

View file

@ -35,12 +35,16 @@ export class RootViewModel extends ViewModel {
async load() {
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._applyNavigation(true);
}
async _applyNavigation(shouldRestoreLastUrl) {
const isLogin = this.navigation.observe("login").get();
const sessionId = this.navigation.observe("session").get();
const SSOSegment = this.navigation.path.get("sso");
if (isLogin) {
if (this.activeSection !== "login") {
this._showLogin();
@ -65,7 +69,10 @@ export class RootViewModel extends ViewModel {
this._showSessionLoader(sessionId);
}
}
} else {
} else if (SSOSegment) {
this._setSection(() => this.showCompletionView = true);
}
else {
try {
if (!(shouldRestoreLastUrl && this.urlCreator.tryRestoreLastUrl())) {
const sessionInfos = await this.platform.sessionInfoStorage.getAll();
@ -147,6 +154,8 @@ export class RootViewModel extends ViewModel {
return "picker";
} else if (this._sessionLoadViewModel) {
return "loading";
} else if (this.showCompletionView) {
return "sso";
} else {
return "redirecting";
}

View file

@ -20,6 +20,7 @@ import {SessionLoadView} from "./login/SessionLoadView.js";
import {SessionPickerView} from "./login/SessionPickerView.js";
import {TemplateView} from "./general/TemplateView.js";
import {StaticView} from "./general/StaticView.js";
import {CompleteSSOView} from "../../../domain/CompleteSSOView.js";
export class RootView extends TemplateView {
render(t, vm) {
@ -42,6 +43,8 @@ export class RootView extends TemplateView {
return new StaticView(t => t.p("Redirecting..."));
case "loading":
return new SessionLoadView(vm.sessionLoadViewModel);
case "sso":
return new CompleteSSOView();
default:
throw new Error(`Unknown section: ${vm.activeSection}`);
}