Exemple #1
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                var userData = await AuthState.GetAuthenticationStateAsync();

                string userName = userData?.User?.Identity?.Name;
                if (userData?.User?.Identity?.IsAuthenticated ?? false)
                {
                    var user = await PublicClient.GetOrAddUser(userName);

                    AppState.CurrentUser = user;
                }
            }
            await base.OnAfterRenderAsync(firstRender);
        }