Bug Fixing overall
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Location } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
@@ -46,7 +47,6 @@ export class DetailsBusinessListingComponent {
|
||||
listing: BusinessListing;
|
||||
criteria: ListingCriteria;
|
||||
mailinfo: MailInfo;
|
||||
propertyImages: string[] = [];
|
||||
environment = environment;
|
||||
user: User;
|
||||
description: SafeHtml;
|
||||
@@ -59,27 +59,28 @@ export class DetailsBusinessListingComponent {
|
||||
private mailService: MailService,
|
||||
private messageService: MessageService,
|
||||
private sanitizer: DomSanitizer,
|
||||
private location: Location,
|
||||
) {
|
||||
this.userService.getUserObservable().subscribe(user => {
|
||||
this.user = user;
|
||||
this.mailinfo = { sender: {}, userId: '', email: user.email };
|
||||
});
|
||||
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
||||
this.mailinfo = { sender: {}, userId: '' };
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'business'));
|
||||
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
|
||||
this.description = this.sanitizer.bypassSecurityTrustHtml(this.listing.description);
|
||||
}
|
||||
back() {
|
||||
this.router.navigate(['businessListings']);
|
||||
this.location.back();
|
||||
}
|
||||
isAdmin() {
|
||||
return this.userService.hasAdminRole();
|
||||
}
|
||||
async mail() {
|
||||
this.mailinfo.userId = this.listing.userId;
|
||||
this.mailinfo.listing = this.listing;
|
||||
await this.mailService.mail(this.mailinfo);
|
||||
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Your message has been sent to the creator of the listing', life: 3000 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user