web/admin: fix sidebar avatar not loaded (#5184)
This commit is contained in:
parent
c4b11ca861
commit
f84c176bd0
|
@ -1,9 +1,10 @@
|
|||
import { AdminInterface } from "@goauthentik/admin/AdminInterface";
|
||||
import { AKElement, rootInterface } from "@goauthentik/elements/Base";
|
||||
import { me } from "@goauthentik/common/users";
|
||||
import { AKElement } from "@goauthentik/elements/Base";
|
||||
|
||||
import { CSSResult, TemplateResult, css, html } from "lit";
|
||||
import { customElement } from "lit/decorators.js";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
import { until } from "lit/directives/until.js";
|
||||
|
||||
import PFAvatar from "@patternfly/patternfly/components/Avatar/avatar.css";
|
||||
import PFNav from "@patternfly/patternfly/components/Nav/nav.css";
|
||||
|
@ -33,12 +34,18 @@ export class SidebarUser extends AKElement {
|
|||
}
|
||||
|
||||
render(): TemplateResult {
|
||||
const me = rootInterface<AdminInterface>()?.user;
|
||||
return html`
|
||||
<a href="/if/user/#/settings" class="pf-c-nav__link user-avatar" id="user-settings">
|
||||
${me
|
||||
? html`<img class="pf-c-avatar" src="${ifDefined(me.user.avatar)}" alt="" />`
|
||||
: html``}
|
||||
${until(
|
||||
me().then((u) => {
|
||||
return html`<img
|
||||
class="pf-c-avatar"
|
||||
src="${ifDefined(u.user.avatar)}"
|
||||
alt=""
|
||||
/>`;
|
||||
}),
|
||||
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>
|
||||
|
|
Reference in New Issue