Browse Source

LogoComponent improve init logic.

pull/14057/head
deaflynx 1 year ago
parent
commit
3c830a3179
  1. 12
      ui-ngx/src/app/shared/components/logo.component.ts

12
ui-ngx/src/app/shared/components/logo.component.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import { Component, Input, AfterViewInit } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { coerceBoolean } from '@shared/decorators/coercion';
import { AuthService } from '@core/auth/auth.service';
import { AppState } from '@core/core.state';
@ -28,7 +28,7 @@ import { UrlHolder } from '@shared/pipe/image.pipe';
templateUrl: './logo.component.html',
styleUrls: ['./logo.component.scss']
})
export class LogoComponent implements AfterViewInit {
export class LogoComponent implements OnInit {
@Input()
@coerceBoolean()
@ -44,12 +44,10 @@ export class LogoComponent implements AfterViewInit {
private store: Store<AppState>) {
}
ngAfterViewInit() {
ngOnInit() {
if (!this.isLogin && !this.logoUrl) {
setTimeout(() => {
const authState = getCurrentAuthState(this.store);
this.logoUrl = this.authService.defaultUrl(true, authState);
}, 0);
const authState = getCurrentAuthState(this.store);
this.logoUrl = this.authService.defaultUrl(true, authState);
}
}
}

Loading…
Cancel
Save