Browse Source

Task/eliminate OnDestroy lifecycle hook from auth page (#6528)

* Eliminate OnDestroy lifecycle hook
pull/6560/head
Erwin 1 week ago
committed by GitHub
parent
commit
319bde1816
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 17
      apps/client/src/app/pages/auth/auth-page.component.ts

17
apps/client/src/app/pages/auth/auth-page.component.ts

@ -4,20 +4,18 @@ import {
} from '@ghostfolio/client/services/settings-storage.service'; } from '@ghostfolio/client/services/settings-storage.service';
import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service'; import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service';
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, DestroyRef, OnInit } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@Component({ @Component({
selector: 'gf-auth-page', selector: 'gf-auth-page',
styleUrls: ['./auth-page.scss'], styleUrls: ['./auth-page.scss'],
templateUrl: './auth-page.html' templateUrl: './auth-page.html'
}) })
export class GfAuthPageComponent implements OnDestroy, OnInit { export class GfAuthPageComponent implements OnInit {
private unsubscribeSubject = new Subject<void>();
public constructor( public constructor(
private destroyRef: DestroyRef,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private settingsStorageService: SettingsStorageService, private settingsStorageService: SettingsStorageService,
@ -26,7 +24,7 @@ export class GfAuthPageComponent implements OnDestroy, OnInit {
public ngOnInit() { public ngOnInit() {
this.route.params this.route.params
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((params) => { .subscribe((params) => {
const jwt = params['jwt']; const jwt = params['jwt'];
@ -38,9 +36,4 @@ export class GfAuthPageComponent implements OnDestroy, OnInit {
this.router.navigate(['/']); this.router.navigate(['/']);
}); });
} }
public ngOnDestroy() {
this.unsubscribeSubject.next();
this.unsubscribeSubject.complete();
}
} }

Loading…
Cancel
Save