Refresh horizontal menu on login change
This commit is contained in:
parent
54bf47122c
commit
3eb1f23977
|
@ -1,6 +1,7 @@
|
||||||
import { Component, OnInit } from '@angular/core'
|
import { Component, OnDestroy, OnInit } from '@angular/core'
|
||||||
import { AuthService, ServerService } from '@app/core'
|
import { AuthService, ServerService } from '@app/core'
|
||||||
import { HorizontalMenuComponent, HorizontalMenuEntry } from '@app/shared/shared-main/menu/horizontal-menu.component'
|
import { HorizontalMenuComponent, HorizontalMenuEntry } from '@app/shared/shared-main/menu/horizontal-menu.component'
|
||||||
|
import { Subscription } from 'rxjs'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-home-menu',
|
selector: 'my-home-menu',
|
||||||
|
@ -8,9 +9,11 @@ import { HorizontalMenuComponent, HorizontalMenuEntry } from '@app/shared/shared
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [ HorizontalMenuComponent ]
|
imports: [ HorizontalMenuComponent ]
|
||||||
})
|
})
|
||||||
export class HomeMenuComponent implements OnInit {
|
export class HomeMenuComponent implements OnInit, OnDestroy {
|
||||||
menuEntries: HorizontalMenuEntry[] = []
|
menuEntries: HorizontalMenuEntry[] = []
|
||||||
|
|
||||||
|
private sub: Subscription
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private server: ServerService,
|
private server: ServerService,
|
||||||
private authService: AuthService
|
private authService: AuthService
|
||||||
|
@ -19,6 +22,17 @@ export class HomeMenuComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
|
this.buildMenu()
|
||||||
|
|
||||||
|
this.sub = this.authService.loginChangedSource
|
||||||
|
.subscribe(() => this.buildMenu())
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy () {
|
||||||
|
if (this.sub) this.sub.unsubscribe()
|
||||||
|
}
|
||||||
|
|
||||||
|
buildMenu () {
|
||||||
const config = this.server.getHTMLConfig()
|
const config = this.server.getHTMLConfig()
|
||||||
this.menuEntries = []
|
this.menuEntries = []
|
||||||
|
|
||||||
|
|
|
@ -4,4 +4,4 @@ set -eu
|
||||||
|
|
||||||
npm run concurrently -- -k \
|
npm run concurrently -- -k \
|
||||||
"cd client/src/standalone/videos/ && npx vite-bundle-visualizer" \
|
"cd client/src/standalone/videos/ && npx vite-bundle-visualizer" \
|
||||||
"cd client && npx esbuild-visualizer --metadata ./dist/en-US/stats.json"
|
"cd client && npx esbuild-visualizer --metadata ./dist/en-US/stats.json --open"
|
||||||
|
|
Loading…
Reference in New Issue