forked from mystiq/hydrogen-web
Show completion view on sso segment
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
75d71717d8
commit
4b87887a4f
2 changed files with 13 additions and 1 deletions
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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}`);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue