Issues gitea
This commit is contained in:
@@ -174,6 +174,9 @@ export class BrokerListingsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('Toggling favorite for:', professional.email, 'Current user:', this.currentUser.email);
|
||||
console.log('Before update, favorites:', professional.favoritesForUser);
|
||||
|
||||
if (this.isFavorite(professional)) {
|
||||
// Remove from favorites
|
||||
await this.listingsService.removeFavorite(professional.id, 'user');
|
||||
@@ -186,8 +189,12 @@ export class BrokerListingsComponent implements OnInit, OnDestroy {
|
||||
if (!professional.favoritesForUser) {
|
||||
professional.favoritesForUser = [];
|
||||
}
|
||||
professional.favoritesForUser.push(this.currentUser.email);
|
||||
// Use spread to create new array reference
|
||||
professional.favoritesForUser = [...professional.favoritesForUser, this.currentUser.email];
|
||||
}
|
||||
|
||||
console.log('After update, favorites:', professional.favoritesForUser);
|
||||
this.cdRef.markForCheck();
|
||||
this.cdRef.detectChanges();
|
||||
} catch (error) {
|
||||
console.error('Error toggling favorite:', error);
|
||||
|
||||
Reference in New Issue
Block a user