Exemple #1
0
        protected override async Task OnInitializedAsync()
        {
            // Get the current user
            CurrentUser = (await authenticationStateTask).User;

            logs = await LogService.GetLogsAsync(CurrentPage);

            DisqusState.SetDisplayDisqus(false);
        }
Exemple #2
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                if (Convert.ToBoolean(objGeneralSettings.DisqusEnabled))
                {
                    string url = NavigationManager.ToAbsoluteUri($"/ViewBlogPost/{NormalizeTitle}").AbsoluteUri;

                    await DisqusInterop.ResetDisqus(
                        JSRuntime,
                        NormalizeTitle.ToString(),
                        url,
                        SelectedBlog.Title);

                    DisqusState.SetDisplayDisqus(true);
                }
            }
        }
Exemple #3
0
        protected override async Task OnInitializedAsync()
        {
            if (BlogSearchState.CurrentPage == 0)
            {
                BlogSearchState.CurrentPage = 1;
            }

            if (BlogSearchState.CurrentCategoryID == 0)
            {
                BlogSearchState.CurrentCategoryID = 0;
            }

            // ensure there is a ADMINISTRATION_ROLE
            var RoleResult = await _roleManager.FindByNameAsync(Constant.ADMINISTRATION_ROLE);

            if (RoleResult == null)
            {
                await _roleManager.CreateAsync(new IdentityRole(Constant.ADMINISTRATION_ROLE));
            }



            // Get the current user
            CurrentUser = (await authenticationStateTask).User;

            if (CurrentUser.Identity.IsAuthenticated)
            {
                var Current_User = await _userManager.FindByNameAsync(CurrentUser.Identity.Name);

                // Is user an administrator?
                UserIsAnAdmin = await _userManager.IsInRoleAsync(Current_User, Constant.ADMINISTRATION_ROLE);
            }

            categories = await _categoryService.GetCategorysAsync();

            // We access BlogsService using @Service
            await BlogUpdatedEvent();

            DisqusState.SetDisplayDisqus(false);
        }