Skip to content

Commit

Permalink
fix(user): update user if input data is changed (#553)
Browse files Browse the repository at this point in the history
* fix(user): update user if input data is changed
this fixes the bug, that vCard or bookmarks are not update if the user is
changed directly

* Update Phonebook.Frontend/src/app/shared/components/user/user-detail/user-detail.component.ts
  • Loading branch information
DanielHabenicht authored Apr 12, 2020
1 parent 0b0ec3d commit 99a57d5
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, HostListener, Input, OnDestroy, OnInit } from '@angular/core';
import { Component, HostListener, Input, OnDestroy, OnInit, OnChanges } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';

import { Select, Store } from '@ngxs/store';
Expand All @@ -22,7 +22,7 @@ export interface IncorrectUserInformationDialogData {
templateUrl: './user-detail.component.html',
styleUrls: ['./user-detail.component.scss']
})
export class UserDetailComponent implements OnInit, OnDestroy {
export class UserDetailComponent implements OnInit, OnChanges, OnDestroy {
@Input()
public person: Person;
public bookmarked: Bookmarked = Bookmarked.isNotBookmarked;
Expand All @@ -49,7 +49,9 @@ export class UserDetailComponent implements OnInit, OnDestroy {
private dialog: MatDialog
) { }

public ngOnInit() {
public ngOnInit() {}

public ngOnChanges(): void {
this.rocketChatLink = this.getRocketChatLink();
this.bookmarks$.pipe(untilComponentDestroyed(this)).subscribe(bookmarks => {
const index = bookmarks.findIndex(p => p.Id === this.person.Id);
Expand Down

0 comments on commit 99a57d5

Please sign in to comment.