Move some subscriptions' lifespan. Added automatic TTS login (when there's an API key)

This commit is contained in:
Tom
2025-01-15 20:45:26 +00:00
parent 6ee99466f8
commit a19a7a0217
2 changed files with 23 additions and 12 deletions

View File

@ -34,12 +34,8 @@ export class TtsLoginComponent implements OnInit, OnDestroy {
ngOnInit(): void {
this.route.data.subscribe(d => this.api_keys = d['keys']);
this.subscriptions.push(this.events.listen('tts_login_ack', async _ => {
await this.router.navigate(['policies'])
}));
this.subscriptions.push(this.events.listen('tts_logoff', async _ => {
this.selected_api_key = undefined;
await this.router.navigate(['tts-login'])
}));
this.subscriptions.push(this.events.listen('impersonation', _ => {
this.selected_api_key = undefined;
@ -51,8 +47,7 @@ export class TtsLoginComponent implements OnInit, OnDestroy {
}
ngOnDestroy(): void {
if (!this.hermes.logged_in)
this.subscriptions.forEach(s => s.unsubscribe());
this.subscriptions.forEach(s => s.unsubscribe());
}
login() {