Currently, I have a Typescript function that is responsible for converting a list of elements into a Map object.
During this conversion process, there is a need to make some modifications in the Map before it is returned. To do so, I must make an http.GET request/subscription to a server to fetch the required value.
The challenge arises when I attempt to use the value immediately after making the GET request, as the server response is still pending. This results in the Map being returned with an incorrect value, which creates issues later on when using this map with the incorrect data.
I am seeking a way to synchronize my function with the result of the GET request before proceeding to process the Map further down the code (after returning the function).
I have heard suggestions about using Observables as a potential solution but am unsure about how to implement this approach.
Any assistance or guidance would be greatly appreciated!
Warm regards, Charles.