Browse Source

Move user state init

pull/3859/head
Matej Gerek 11 months ago
committed by Thomas Kaul
parent
commit
f2963ecaa7
  1. 21
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

21
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

@ -147,7 +147,15 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
) {} ) {}
public ngOnInit() { public ngOnInit() {
const { tags } = this.user; this.userService.stateChanged
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe((state) => {
if (state?.user) {
this.user = state.user;
this.changeDetectorRef.markForCheck();
}
});
this.activityForm = this.formBuilder.group({ this.activityForm = this.formBuilder.group({
tags: <string[]>[] tags: <string[]>[]
@ -158,6 +166,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
{ id: this.data.symbol, type: 'SYMBOL' } { id: this.data.symbol, type: 'SYMBOL' }
]; ];
const { tags } = this.user;
this.tagsAvailable = tags.map((tag) => { this.tagsAvailable = tags.map((tag) => {
return { return {
...tag, ...tag,
@ -427,16 +436,6 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
} }
); );
this.userService.stateChanged
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe((state) => {
if (state?.user) {
this.user = state.user;
this.changeDetectorRef.markForCheck();
}
});
} }
public onAddTag(event: MatAutocompleteSelectedEvent) { public onAddTag(event: MatAutocompleteSelectedEvent) {

Loading…
Cancel
Save