I am building a server sided project in ASP.NET Core Blazor using the DevExpress XAF framework and I wanted to override the OnLoggedOn function to show a SweetAlert2 JavaScript popup.
The problem is that the popup sometimes (doesn't happen every time) loads twice because the OnLoggedOn I guess is called twice? I can't seem to find where the issue is.
Here is my code:
protected override async void OnLoggedOn(LogonEventArgs args)
{
base.OnLoggedOn(args);
_jsRuntime = ServiceProvider.GetService<IJSRuntime>();
_userService = ServiceProvider.GetService<UserService>();
await _jsRuntime.InvokeVoidAsync("showVersionUpdate",CancellationToken.None, version);
_ = Task.Run(async () =>
{
await _userService.SynchronizeAgents();
});
}
By the way, is the OnLoggedOn function called every time the page refreshes?