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