protected async override Task OnAfterRenderAsync(bool firstRender) { await base.OnAfterRenderAsync(firstRender); if (firstRender) { #region Check the accountid var accountId = await BrowserInterop.LocalStorageGet <Guid?>("AccountId"); if (accountId.GetValueOrDefault() == Guid.Empty) { NavigationManager.NavigateTo("/"); return; } _accountId = accountId.Value; #endregion OnMessageReceivedEvent += ChatBase_OnMessageReceive; await BindChats(); StateHasChanged(); } }
protected async override Task OnAfterRenderAsync(bool firstRender) { await base.OnAfterRenderAsync(firstRender); if (firstRender) { var accountId = await BrowserInterop.LocalStorageGet <Guid?>("AccountId"); if (accountId.GetValueOrDefault() != Guid.Empty) { NavigateToChat(); return; } OnQrCodeReceivedEvent += AuthenticationBase_OnQrCodeReceivedEvent; OnAuthenticatedEvent += AuthenticationBase_OnAuthenticatedEvent; // initialize a new account if there isn't on localstorage above if (_accountId == Guid.Empty) { _accountId = Guid.NewGuid(); } await HttpClient.PostAsync($"account/{_accountId}", null); } }