This commit is contained in:
2024-05-15 17:35:04 -05:00
parent 474d7c63d5
commit f51a298227
39 changed files with 333 additions and 260 deletions

View File

@@ -6,7 +6,6 @@ import { ListingsService } from '../../../services/listings.service';
import { SelectOptionsService } from '../../../services/select-options.service';
import { UserService } from '../../../services/user.service';
import { SharedModule } from '../../../shared/shared/shared.module';
import { getListingType, isBusinessListing, isCommercialPropertyListing } from '../../../utils/utils';
import { MenuAccountComponent } from '../../menu-account/menu-account.component';
@Component({
selector: 'app-my-listing',
@@ -20,8 +19,6 @@ export class MyListingComponent {
listings: Array<ListingType> = []; //dataListings as unknown as Array<BusinessListing>;
myListings: Array<ListingType>;
user: User;
isBusinessListing = isBusinessListing;
isCommercialPropertyListing = isCommercialPropertyListing;
constructor(
public userService: UserService,
private listingsService: ListingsService,
@@ -39,7 +36,7 @@ export class MyListingComponent {
}
async deleteListing(listing: ListingType) {
await this.listingsService.deleteListing(listing.id, getListingType(listing));
await this.listingsService.deleteListing(listing.id, listing.listingsCategory);
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]];
}