mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Fix 403 on state-badge connect (#16795)
This commit is contained in:
parent
fd1381ab3b
commit
c39fdcda6e
@ -38,6 +38,31 @@ export class StateBadge extends LitElement {
|
||||
|
||||
@state() private _iconStyle: { [name: string]: string | undefined } = {};
|
||||
|
||||
connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
if (
|
||||
this.hasUpdated &&
|
||||
this.overrideImage === undefined &&
|
||||
(this.stateObj?.attributes.entity_picture ||
|
||||
this.stateObj?.attributes.entity_picture_local)
|
||||
) {
|
||||
// Update image on connect, so we get new auth token
|
||||
this.requestUpdate("stateObj");
|
||||
}
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
if (
|
||||
this.overrideImage === undefined &&
|
||||
(this.stateObj?.attributes.entity_picture ||
|
||||
this.stateObj?.attributes.entity_picture_local)
|
||||
) {
|
||||
// Clear image on disconnect so we don't fetch with old auth when we reconnect
|
||||
this.style.backgroundImage = "";
|
||||
}
|
||||
}
|
||||
|
||||
private get _stateColor() {
|
||||
const domain = this.stateObj
|
||||
? computeStateDomain(this.stateObj)
|
||||
|
Loading…
x
Reference in New Issue
Block a user