feat(app): wire dashboard administration flows
This commit is contained in:
@@ -19,7 +19,7 @@ export class IdpState {
|
||||
public idpClient = new plugins.idpClient.IdpClient(this.receptionUrl);
|
||||
public domtools: domtools.DomTools;
|
||||
public mainStatePart: plugins.deesDomtools.plugins.smartstate.StatePart<'main', {
|
||||
view: 'welcome' | 'login' | 'register' | 'finishregistration' | 'account' | 'logout';
|
||||
view: 'welcome' | 'login' | 'register' | 'finishregistration' | 'dash' | 'logout';
|
||||
}>
|
||||
|
||||
public async init() {
|
||||
@@ -38,6 +38,12 @@ export class IdpState {
|
||||
});
|
||||
|
||||
this.domtools.router.on('/login', async () => {
|
||||
const isOauthLogin = new URL(window.location.href).searchParams.get('oauth') === 'true';
|
||||
if (!isOauthLogin && await this.idpClient.determineLoginStatus(false)) {
|
||||
this.domtools.router.pushUrl('/dash/overview');
|
||||
return;
|
||||
}
|
||||
|
||||
await this.mainStatePart.setState({
|
||||
...this.mainStatePart.getState(),
|
||||
view: 'login',
|
||||
@@ -53,6 +59,11 @@ export class IdpState {
|
||||
});
|
||||
|
||||
this.domtools.router.on('/register', async () => {
|
||||
if (await this.idpClient.determineLoginStatus(false)) {
|
||||
this.domtools.router.pushUrl('/dash/overview');
|
||||
return;
|
||||
}
|
||||
|
||||
await this.mainStatePart.setState({
|
||||
...this.mainStatePart.getState(),
|
||||
view: 'register',
|
||||
@@ -66,13 +77,18 @@ export class IdpState {
|
||||
})
|
||||
});
|
||||
|
||||
this.domtools.router.on('/account{/*path}', async () => {
|
||||
this.domtools.router.on('/dash{/*path}', async () => {
|
||||
if (!await this.idpClient.determineLoginStatus(false)) {
|
||||
this.domtools.router.pushUrl('/login');
|
||||
return;
|
||||
}
|
||||
|
||||
await this.mainStatePart.setState({
|
||||
...this.mainStatePart.getState(),
|
||||
view: 'account',
|
||||
view: 'dash',
|
||||
})
|
||||
});
|
||||
|
||||
this.domtools.router._handleRouteState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user