I have successfully stored the api_url in IndexedDB using NgxIndexedDBService. However, I am encountering an issue where I need to fetch the api_url before any service call is made. The problem arises when I attempt to call a service method from the constructor of a component, resulting in an exception because the api_url is still undefined while the subscribe method is fetching data from IndexedDB.
this.dbService.getByKey('CompanyInfo', 'test').subscribe((key: any) =>
{
this.apiendpoint = key.API_URL;
});
Can anyone suggest an approach to delay the execution until the service constructor has completed? Alternatively, are there any other suggestions for handling this situation?