web: fix SidebarUser not rendering

This commit is contained in:
Jens Langhammer 2020-12-02 14:45:19 +01:00
parent cc5a0c23aa
commit dc4a7d98e8
1 changed files with 6 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import fa from "@fortawesome/fontawesome-free/css/all.css";
// @ts-ignore
import AvatarStyle from "@patternfly/patternfly/components/Avatar/avatar.css";
import { User } from "../../api/user";
import { until } from "lit-html/directives/until";
@customElement("pb-sidebar-user")
export class SidebarUser extends LitElement {
@ -41,12 +42,13 @@ export class SidebarUser extends LitElement {
];
}
async render(): Promise<TemplateResult> {
const user = await User.me();
render(): TemplateResult {
return html`
<a href="#/-/user/" class="pf-c-nav__link user-avatar" id="user-settings">
<img class="pf-c-avatar" src="${user.avatar}" alt="" />
<span>${user.username}</span>
${until(User.me().then(u => {
return html`<img class="pf-c-avatar" src="${u.avatar}" alt="" />
<span>${u.username}</span>`;
}), html``)}
</a>
<a href="/flows/-/default/invalidation/" class="pf-c-nav__link user-logout" id="logout">
<i class="fas fa-sign-out-alt" aria-hidden="true"></i>