Bug Fixing overall
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { ChangeDetectorRef, Component } from '@angular/core';
|
||||
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||
import { 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';
|
||||
@@ -18,7 +19,7 @@ import { MenuAccountComponent } from '../../menu-account/menu-account.component'
|
||||
export class MyListingComponent {
|
||||
listings: Array<ListingType> = []; //dataListings as unknown as Array<BusinessListing>;
|
||||
myListings: Array<ListingType>;
|
||||
userId: string;
|
||||
user: User;
|
||||
isBusinessListing = isBusinessListing;
|
||||
isCommercialPropertyListing = isCommercialPropertyListing;
|
||||
constructor(
|
||||
@@ -30,13 +31,15 @@ export class MyListingComponent {
|
||||
private messageService: MessageService,
|
||||
) {}
|
||||
async ngOnInit() {
|
||||
this.userId = await this.userService.getId();
|
||||
this.myListings = await this.listingsService.getListingByUserId(this.userId);
|
||||
const keycloakUser = this.userService.getKeycloakUser();
|
||||
const email = keycloakUser.email;
|
||||
this.user = await this.userService.getByMail(email);
|
||||
this.myListings = await this.listingsService.getListingByUserId(this.user.id);
|
||||
}
|
||||
|
||||
async deleteListing(listing: ListingType) {
|
||||
await this.listingsService.deleteListing(listing.id, getListingType(listing));
|
||||
this.myListings = await this.listingsService.getListingByUserId(this.userId);
|
||||
this.myListings = await this.listingsService.getListingByUserId(this.user.id);
|
||||
}
|
||||
|
||||
confirm(event: Event, listing: ListingType) {
|
||||
|
||||
Reference in New Issue
Block a user