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 { me } from "@goauthentik/common/users";
|
||||||
import { AKElement, rootInterface } from "@goauthentik/elements/Base";
|
import { AKElement } from "@goauthentik/elements/Base";
|
||||||
|
|
||||||
import { CSSResult, TemplateResult, css, html } from "lit";
|
import { CSSResult, TemplateResult, css, html } from "lit";
|
||||||
import { customElement } from "lit/decorators.js";
|
import { customElement } from "lit/decorators.js";
|
||||||
import { ifDefined } from "lit/directives/if-defined.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 PFAvatar from "@patternfly/patternfly/components/Avatar/avatar.css";
|
||||||
import PFNav from "@patternfly/patternfly/components/Nav/nav.css";
|
import PFNav from "@patternfly/patternfly/components/Nav/nav.css";
|
||||||
|
@ -33,12 +34,18 @@ export class SidebarUser extends AKElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): TemplateResult {
|
render(): TemplateResult {
|
||||||
const me = rootInterface<AdminInterface>()?.user;
|
|
||||||
return html`
|
return html`
|
||||||
<a href="/if/user/#/settings" class="pf-c-nav__link user-avatar" id="user-settings">
|
<a href="/if/user/#/settings" class="pf-c-nav__link user-avatar" id="user-settings">
|
||||||
${me
|
${until(
|
||||||
? html`<img class="pf-c-avatar" src="${ifDefined(me.user.avatar)}" alt="" />`
|
me().then((u) => {
|
||||||
: html``}
|
return html`<img
|
||||||
|
class="pf-c-avatar"
|
||||||
|
src="${ifDefined(u.user.avatar)}"
|
||||||
|
alt=""
|
||||||
|
/>`;
|
||||||
|
}),
|
||||||
|
html``,
|
||||||
|
)}
|
||||||
</a>
|
</a>
|
||||||
<a href="/flows/-/default/invalidation/" class="pf-c-nav__link user-logout" id="logout">
|
<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>
|
<i class="fas fa-sign-out-alt" aria-hidden="true"></i>
|
||||||
|
|
Reference in New Issue