Newer
Older
doctype html
html
include includes/head.pug
sib-router(default-route='splash')
sib-route(name='splash')
sib-route(name='mentor-new-account')
sib-route(name='entrepreneur-new-account')
sib-route(name='mentor-dashboard')
sib-route(name='entrepreneur-dashboard')
#mentor-dashboard(hidden).no-sidebar
include includes/mentor/dashboard.pug
#entrepreneur-dashboard(hidden).no-sidebar
include includes/entrepreneur/dashboard.pug
include includes/splash.pug
#mentor-new-account(hidden).no-sidebar
include includes/mentor/create.pug
#entrepreneur-new-account(hidden).no-sidebar
include includes/entrepreneur/create.pug
sib-auth
sib-auth-provider(
class="sib-auth-provider"
data-authority=`${sdn}`
data-client_id=`${client_id}`,
data-id="coopstarter"
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
)
script(type='module').
import { store } from 'https://unpkg.com/@startinblox/core@0.8';
const sibAuth = document.querySelector('sib-auth');
class CoopStarterLoginComponent extends HTMLElement {
async connectedCallback() {
mentor_login.onclick = () => this.triggerLogin();
entrepreneur_login.onclick = () => this.triggerLogin();
this.update();
}
async triggerLogin() {
await sibAuth.login();
}
async update() {
let user = await sibAuth.getUser();
let idToken = await sibAuth.getUserIdToken();
if ( !user ) {
return;
}
user = await store.get(user);
if (user && user.mentor_profile) {
window.dispatchEvent(
new CustomEvent('requestNavigation', { detail: { route: 'mentor-dashboard' } })
);
} else if (user && user.entrepreneur_profile) {
window.dispatchEvent(
new CustomEvent('requestNavigation', { detail: { route: 'entrepreneur-dashboard' } })
);
}
}
empty(){}
populate(){}
}
customElements.define('cs-login', CoopStarterLoginComponent);