Issues gitea
This commit is contained in:
@@ -379,13 +379,27 @@ export class DetailsBusinessListingComponent extends BaseDetailsComponent {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
async save() {
|
||||
await this.listingsService.addToFavorites(this.listing.id, 'business');
|
||||
this.listing.favoritesForUser.push(this.user.email);
|
||||
this.auditService.createEvent(this.listing.id, 'favorite', this.user?.email);
|
||||
}
|
||||
isAlreadyFavorite() {
|
||||
return this.listing.favoritesForUser.includes(this.user.email);
|
||||
async toggleFavorite() {
|
||||
try {
|
||||
const isFavorited = this.listing.favoritesForUser.includes(this.user.email);
|
||||
|
||||
if (isFavorited) {
|
||||
// Remove from favorites
|
||||
await this.listingsService.removeFavorite(this.listing.id, 'business');
|
||||
this.listing.favoritesForUser = this.listing.favoritesForUser.filter(
|
||||
email => email !== this.user.email
|
||||
);
|
||||
} else {
|
||||
// Add to favorites
|
||||
await this.listingsService.addToFavorites(this.listing.id, 'business');
|
||||
this.listing.favoritesForUser.push(this.user.email);
|
||||
this.auditService.createEvent(this.listing.id, 'favorite', this.user?.email);
|
||||
}
|
||||
|
||||
this.cdref.detectChanges();
|
||||
} catch (error) {
|
||||
console.error('Error toggling favorite:', error);
|
||||
}
|
||||
}
|
||||
async showShareByEMail() {
|
||||
const result = await this.emailService.showShareByEMail({
|
||||
|
||||
Reference in New Issue
Block a user