I am trying to open a pop up on a mouse click event, but the pop up appears only after receiving response from GetClosetsSites()
function, which takes a few seconds.
how can I change the following code to make the pop up to open immediately?
function:
async openInfo(e: any, x: any, y: any) {
try {
const closestArchPromise = this.siteservice.GetClosetsSites(e.wgS84_Info.geography);
const siteIdPromise = this.siteservice.GetSiteId(e.resourceID).toPromise();
const [closestArch, siteId] = await Promise.all([closestArchPromise, siteIdPromise]);
this.dialog.closeAll();
this.dialog.open(InformationComponent, {
data: { arch: siteId, closestArch: closestArch, lang: this.browserLang },
panelClass: 'custom-dialog-container'
});
} catch (error) {
console.log(error);
}
}
backend request:
async GetClosetsSites(wgS84_Info: geography) {
try {
const response = await this.http.get<Site[]>(this.baseUrl + 'Site/GetclosestSites?KnownText=' + wgS84_Info.KnownText + '&SystemId=' + wgS84_Info.SystemId).toPromise();
return response;
} catch (err) {
console.log(err);
}
}