aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/wwwroot/scripts/components/profile-modal.js
blob: f4e90d50b72bb007232c9935fc48c5c065f97746 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class ProfileModal extends HTMLElement {
    constructor() {
        super();
        retry(session.get, res => (res?.username?.length > 0 ?? false), 0).then(sessionData => {
            const root = create_element("div", {
                style: {
                    padding: "5px",
                    display: ""
                }
            }, [
                create_element("h4", {innerText: sessionData.username, style: {margin: 0}}),
                create_element("p", {innerText: sessionData.role}),
                create_element("button", {innerText: "Log out", classList: ["do-logout"]})
            ]);
            this.innerHTML = root.innerHTML;
        });
    }
}

customElements.define('profile-modal', ProfileModal);