Browse Source

Merge 9418027fa8 into 6e7dda184c

pull/6591/merge
Witheast 2 weeks ago
committed by GitHub
parent
commit
1d157846f9
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 19
      apps/client/src/app/pages/open/open-page.component.ts

19
apps/client/src/app/pages/open/open-page.component.ts

@ -7,11 +7,11 @@ import {
ChangeDetectorRef,
Component,
CUSTOM_ELEMENTS_SCHEMA,
OnDestroy,
OnInit
inject,
DestroyRef
} from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { MatCardModule } from '@angular/material/card';
import { Subject, takeUntil } from 'rxjs';
@Component({
host: { class: 'page' },
@ -21,11 +21,11 @@ import { Subject, takeUntil } from 'rxjs';
styleUrls: ['./open-page.scss'],
templateUrl: './open-page.html'
})
export class GfOpenPageComponent implements OnDestroy, OnInit {
export class GfOpenPageComponent {
public statistics: Statistics;
public user: User;
private unsubscribeSubject = new Subject<void>();
private destroyRef = inject(DestroyRef);
public constructor(
private changeDetectorRef: ChangeDetectorRef,
@ -35,11 +35,9 @@ export class GfOpenPageComponent implements OnDestroy, OnInit {
const { statistics } = this.dataService.fetchInfo();
this.statistics = statistics;
}
public ngOnInit() {
this.userService.stateChanged
.pipe(takeUntil(this.unsubscribeSubject))
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((state) => {
if (state?.user) {
this.user = state.user;
@ -48,9 +46,4 @@ export class GfOpenPageComponent implements OnDestroy, OnInit {
}
});
}
public ngOnDestroy() {
this.unsubscribeSubject.next();
this.unsubscribeSubject.complete();
}
}

Loading…
Cancel
Save