history service, mail template improved, general listing entry

This commit is contained in:
2024-05-14 11:53:20 -05:00
parent aff55c5433
commit d2e5562602
17 changed files with 261 additions and 49 deletions

View File

@@ -0,0 +1,32 @@
import { Injectable } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
@Injectable({
providedIn: 'root',
})
export class HistoryService {
private history: string[] = [];
constructor(private router: Router) {
this.router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
this.history.push(event.urlAfterRedirects);
}
});
}
public getHistory(): string[] {
return this.history;
}
public canGoBack(): boolean {
return this.history.length > 1;
}
public goBack(): void {
if (this.canGoBack()) {
this.history.pop();
this.router.navigateByUrl(this.history[this.history.length - 1]);
}
}
}

View File

@@ -12,9 +12,6 @@ export class ListingsService {
private apiBaseUrl = environment.apiBaseUrl;
constructor(private http: HttpClient) {}
// getAllListings():Observable<ListingType[]>{
// return this.http.get<ListingType[]>(`${this.apiBaseUrl}/bizmatch/business-listings`);
// }
async getListings(criteria: ListingCriteria, listingsCategory: 'business' | 'professionals_brokers' | 'commercialProperty'): Promise<ResponseBusinessListingArray | ResponseCommercialPropertyListingArray> {
const result = await lastValueFrom(this.http.post<ResponseBusinessListingArray | ResponseCommercialPropertyListingArray>(`${this.apiBaseUrl}/bizmatch/listings/${listingsCategory}/search`, criteria));
return result;