history service, mail template improved, general listing entry
This commit is contained in:
32
bizmatch/src/app/services/history.service.ts
Normal file
32
bizmatch/src/app/services/history.service.ts
Normal 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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user