fix further bugs

This commit is contained in:
2024-05-16 15:57:39 -05:00
parent 327aef0f21
commit e0ecea5af2
12 changed files with 135 additions and 101 deletions

View File

@@ -1,6 +1,6 @@
import { ChangeDetectorRef, Component } from '@angular/core';
import { ConfirmationService, MessageService } from 'primeng/api';
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
import { CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
import { ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
import { ListingsService } from '../../../services/listings.service';
import { SelectOptionsService } from '../../../services/select-options.service';
@@ -36,7 +36,11 @@ export class MyListingComponent {
}
async deleteListing(listing: ListingType) {
await this.listingsService.deleteListing(listing.id, listing.listingsCategory);
if (listing.listingsCategory === 'business') {
await this.listingsService.deleteBusinessListing(listing.id);
} else {
await this.listingsService.deleteCommercialPropertyListing(listing.id, (<CommercialPropertyListing>listing).imagePath);
}
const result = await Promise.all([await this.listingsService.getListingByUserId(this.user.id, 'business'), await this.listingsService.getListingByUserId(this.user.id, 'commercialProperty')]);
this.myListings = [...result[0], ...result[1]];
}