Ansichten verbessert - 1. Teil

This commit is contained in:
2024-03-17 20:29:53 +01:00
parent 25b201a9c6
commit 2b27ab8ba5
24 changed files with 322 additions and 108 deletions

View File

@@ -18,20 +18,20 @@ import { BusinessListing, ListingType, User } from '../../../../../../common-mod
})
export class MyListingComponent {
user: User;
listings: Array<BusinessListing> //dataListings as unknown as Array<BusinessListing>;
myListings: Array<BusinessListing>
listings: Array<ListingType> =[]//dataListings as unknown as Array<BusinessListing>;
myListings: Array<ListingType>
constructor(public userService: UserService,private listingsService:ListingsService, private cdRef:ChangeDetectorRef,public selectOptions:SelectOptionsService,private confirmationService: ConfirmationService,private messageService: MessageService){
this.user=this.userService.getUser();
}
async ngOnInit(){
this.listings=await lastValueFrom(this.listingsService.getAllListings());
// this.listings=await lastValueFrom(this.listingsService.getAllListings());
this.myListings=this.listings.filter(l=>l.userId===this.user.id);
}
async deleteListing(listing:ListingType){
await this.listingsService.deleteListing(listing.id);
this.listings=await lastValueFrom(this.listingsService.getAllListings());
await this.listingsService.deleteListing(listing.id,listing.listingsCategory);
// this.listings=await lastValueFrom(this.listingsService.getAllListings());
this.myListings=this.listings.filter(l=>l.userId===this.user.id);
}