diff --git a/src/app/components/add-task/add-task.component.ts b/src/app/components/add-task/add-task.component.ts index 58231df..ad36988 100644 --- a/src/app/components/add-task/add-task.component.ts +++ b/src/app/components/add-task/add-task.component.ts @@ -13,7 +13,7 @@ import { AuthService } from '../../services/auth.service'; import { firstValueFrom, map } from 'rxjs'; import { TaskService } from '../../services/task.service'; import { ApiService } from '../../services/api.service'; -import { TaskUpdateService } from '../../services/task-update.service'; +import { UpdateNotifierService } from '../../services/update-notifier.service'; import { ToastNotificationService } from '../../services/toast-notification.servic'; @Component({ @@ -51,7 +51,7 @@ export class AddTaskComponent implements OnInit { private taskService: TaskService, private apiService: ApiService, private authService: AuthService, - private taskUpdateService: TaskUpdateService, + private updateNotifierService: UpdateNotifierService, private toastNotificationService: ToastNotificationService, private route: ActivatedRoute, private router: Router @@ -380,7 +380,7 @@ export class AddTaskComponent implements OnInit { this.apiService.saveNewTask(taskWithoutId).subscribe({ next: (response) => { this.toastNotificationService.createTaskSuccessToast(); - this.taskUpdateService.notifyTaskUpdate(); + this.updateNotifierService.notifyUpdate('task'); this.removeTaskData(ngForm); this.closeOverlay(); this.router.navigate(['/board']); diff --git a/src/app/components/board/board.component.ts b/src/app/components/board/board.component.ts index 09dccb8..51c5ba5 100644 --- a/src/app/components/board/board.component.ts +++ b/src/app/components/board/board.component.ts @@ -13,7 +13,7 @@ import { Task } from '../../interfaces/task.interface'; import { TaskService } from '../../services/task.service'; import { LoadingSpinnerComponent } from '../../shared/components/loading-spinner/loading-spinner.component'; import { finalize, Subject, takeUntil } from 'rxjs'; -import { TaskUpdateService } from '../../services/task-update.service'; +import { UpdateNotifierService } from '../../services/update-notifier.service'; import { ToastNotificationService } from '../../services/toast-notification.servic'; import { ResizeService } from '../../services/resize.service'; @@ -46,7 +46,7 @@ export class BoardComponent { private resizeService: ResizeService, private taskService: TaskService, private apiService: ApiService, - private taskUpdateService: TaskUpdateService, + private updateNotifierService: UpdateNotifierService, private toastNotificationService: ToastNotificationService, private router: Router ) {} @@ -95,7 +95,7 @@ export class BoardComponent { } private subscribeToTaskUpdates() { - this.taskUpdateService.taskUpdated$ + this.updateNotifierService.taskUpdated$ .pipe(takeUntil(this.destroy$)) .subscribe(() => { this.loadAllTasks(); diff --git a/src/app/components/contacts/contact-detail/contact-detail.component.ts b/src/app/components/contacts/contact-detail/contact-detail.component.ts index 49165ac..c0273a9 100644 --- a/src/app/components/contacts/contact-detail/contact-detail.component.ts +++ b/src/app/components/contacts/contact-detail/contact-detail.component.ts @@ -14,6 +14,7 @@ import { User } from '../../../interfaces/user.interface'; import { OverlayService } from '../../../services/overlay.service'; import { ApiService } from '../../../services/api.service'; import { ToastNotificationService } from '../../../services/toast-notification.servic'; +import { UpdateNotifierService } from '../../../services/update-notifier.service'; @Component({ selector: 'app-contact-detail', @@ -36,7 +37,8 @@ export class ContactDetailComponent { private overlayService: OverlayService, private userService: UserService, private apiService: ApiService, - private toastNotificationService: ToastNotificationService + private toastNotificationService: ToastNotificationService, + private updateNotifierService: UpdateNotifierService ) {} ngOnChanges(changes: SimpleChanges) { @@ -97,14 +99,11 @@ export class ContactDetailComponent { this.isMobileNavbarOpen = false; } - /** - * Opens the delete contact dialog by setting the appropriate flags in the shared service. - * This method is used by the contact details component to open the delete contact dialog when the user clicks the delete button. - */ async deleteContact(userId: string) { try { await lastValueFrom(this.apiService.deleteUserById(userId)); this.toastNotificationService.deleteContactSuccessToast(); + this.updateNotifierService.notifyUpdate('contact'); this.closeUserDetails(); } catch (error) { console.error(error); diff --git a/src/app/components/contacts/contacts.component.html b/src/app/components/contacts/contacts.component.html index a677a6a..8025ab4 100644 --- a/src/app/components/contacts/contacts.component.html +++ b/src/app/components/contacts/contacts.component.html @@ -18,8 +18,8 @@ @for (sortLetter of this.getUniqueFirstLetters(); track sortLetter) {