fix(core): Added logging for user email login process and fixed client URL parsing
This commit is contained in:
+43
-6
@@ -1,17 +1,54 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import { domtools } from '@design.estate/dees-element'
|
||||
|
||||
export class IdpState {
|
||||
// STATIC
|
||||
public static getSingletonInstance() {
|
||||
if (!this.instance) {
|
||||
this.instance = new IdpState();
|
||||
private static idpStateDeferred = plugins.smartpromise.defer<IdpState>();
|
||||
public static async getSingletonInstance() {
|
||||
if (!this.idpStateDeferred.claimed) {
|
||||
this.idpStateDeferred.claim();
|
||||
const newIdpState = new IdpState();
|
||||
await newIdpState.init();
|
||||
this.idpStateDeferred.resolve(newIdpState);
|
||||
}
|
||||
return this.instance;
|
||||
return this.idpStateDeferred.promise;
|
||||
}
|
||||
|
||||
private static instance: IdpState;
|
||||
|
||||
// INSTANCE
|
||||
public receptionUrl = 'https://reception.lossless.one/typedrequest';
|
||||
public idpClient = new plugins.idpClient.IdpClient(this.receptionUrl);
|
||||
public domtools: domtools.DomTools;
|
||||
public mainStatePart: plugins.deesDomtools.plugins.smartstate.StatePart<'main', {
|
||||
view: 'welcome' | 'login' | 'register';
|
||||
}>
|
||||
|
||||
public async init() {
|
||||
const domtoolsInstance = await domtools.DomTools.setupDomTools();
|
||||
this.domtools = domtoolsInstance;
|
||||
const state = new plugins.deesDomtools.plugins.smartstate.Smartstate<'main'>();
|
||||
this.mainStatePart = await state.getStatePart('main', {
|
||||
view: 'welcome',
|
||||
}, 'soft');
|
||||
this.domtools.router.on('/', async () => {
|
||||
await this.mainStatePart.setState({
|
||||
...this.mainStatePart.getState(),
|
||||
view: 'welcome',
|
||||
})
|
||||
});
|
||||
|
||||
this.domtools.router.on('/login', async () => {
|
||||
await this.mainStatePart.setState({
|
||||
...this.mainStatePart.getState(),
|
||||
view: 'login',
|
||||
})
|
||||
});
|
||||
|
||||
this.domtools.router.on('/register', async () => {
|
||||
await this.mainStatePart.setState({
|
||||
...this.mainStatePart.getState(),
|
||||
view: 'register',
|
||||
})
|
||||
});
|
||||
this.domtools.router._handleRouteState();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user