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() {
|
async load() {
|
||||||
this.track(this.navigation.observe("login").subscribe(() => this._applyNavigation()));
|
this.track(this.navigation.observe("login").subscribe(() => this._applyNavigation()));
|
||||||
this.track(this.navigation.observe("session").subscribe(() => this._applyNavigation()));
|
this.track(this.navigation.observe("session").subscribe(() => this._applyNavigation()));
|
||||||
|
this.track(this.navigation.observe("sso").subscribe(() => {
|
||||||
|
this._applyNavigation();
|
||||||
|
}));
|
||||||
this._applyNavigation(true);
|
this._applyNavigation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _applyNavigation(shouldRestoreLastUrl) {
|
async _applyNavigation(shouldRestoreLastUrl) {
|
||||||
const isLogin = this.navigation.observe("login").get();
|
const isLogin = this.navigation.observe("login").get();
|
||||||
const sessionId = this.navigation.observe("session").get();
|
const sessionId = this.navigation.observe("session").get();
|
||||||
|
const SSOSegment = this.navigation.path.get("sso");
|
||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
if (this.activeSection !== "login") {
|
if (this.activeSection !== "login") {
|
||||||
this._showLogin();
|
this._showLogin();
|
||||||
|
@ -65,7 +69,10 @@ export class RootViewModel extends ViewModel {
|
||||||
this._showSessionLoader(sessionId);
|
this._showSessionLoader(sessionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (SSOSegment) {
|
||||||
|
this._setSection(() => this.showCompletionView = true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
try {
|
try {
|
||||||
if (!(shouldRestoreLastUrl && this.urlCreator.tryRestoreLastUrl())) {
|
if (!(shouldRestoreLastUrl && this.urlCreator.tryRestoreLastUrl())) {
|
||||||
const sessionInfos = await this.platform.sessionInfoStorage.getAll();
|
const sessionInfos = await this.platform.sessionInfoStorage.getAll();
|
||||||
|
@ -147,6 +154,8 @@ export class RootViewModel extends ViewModel {
|
||||||
return "picker";
|
return "picker";
|
||||||
} else if (this._sessionLoadViewModel) {
|
} else if (this._sessionLoadViewModel) {
|
||||||
return "loading";
|
return "loading";
|
||||||
|
} else if (this.showCompletionView) {
|
||||||
|
return "sso";
|
||||||
} else {
|
} else {
|
||||||
return "redirecting";
|
return "redirecting";
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import {SessionLoadView} from "./login/SessionLoadView.js";
|
||||||
import {SessionPickerView} from "./login/SessionPickerView.js";
|
import {SessionPickerView} from "./login/SessionPickerView.js";
|
||||||
import {TemplateView} from "./general/TemplateView.js";
|
import {TemplateView} from "./general/TemplateView.js";
|
||||||
import {StaticView} from "./general/StaticView.js";
|
import {StaticView} from "./general/StaticView.js";
|
||||||
|
import {CompleteSSOView} from "../../../domain/CompleteSSOView.js";
|
||||||
|
|
||||||
export class RootView extends TemplateView {
|
export class RootView extends TemplateView {
|
||||||
render(t, vm) {
|
render(t, vm) {
|
||||||
|
@ -42,6 +43,8 @@ export class RootView extends TemplateView {
|
||||||
return new StaticView(t => t.p("Redirecting..."));
|
return new StaticView(t => t.p("Redirecting..."));
|
||||||
case "loading":
|
case "loading":
|
||||||
return new SessionLoadView(vm.sessionLoadViewModel);
|
return new SessionLoadView(vm.sessionLoadViewModel);
|
||||||
|
case "sso":
|
||||||
|
return new CompleteSSOView();
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown section: ${vm.activeSection}`);
|
throw new Error(`Unknown section: ${vm.activeSection}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue