I need to read user id and some more data from session which is crucial to get specific data from the server, check permissions and rendering the screen.
I use Blazored.SessionStorage nuget to do that and use the following code line:
curData = await sessionStorage.GetItemAsync<CurrentData>("CurrentData");
At start I set the following line in OnInitializedAsync procedure but since session reading is async, the code proceeds and try loading data when there is no value in curData variable.
Then I tried to move session reading to SetParametersAsync which seems to be a better approach since this is the first procedure in the lifecycle. Same problem here.
So I tried some methods to wait for the await session to end but it did not work and it stuck the code and the code will not continue.
Bottom line I need help to find a way to load session data in SetParametersAsync and wait for it to finish reading before continue the component lifecycle.
Thanks all