@page "/Notifications" @attribute [Authorize] @using salesbook.Shared.Components.Layout @using salesbook.Shared.Components.SingleElements @using salesbook.Shared.Core.Dto.Notification @using salesbook.Shared.Core.Dto.PageState @using salesbook.Shared.Core.Messages.Notification @inject NotificationState Notification @inject NewPushNotificationService NewPushNotificationService @inject IJSRuntime JS
@if (Notification.UnreadNotifications.IsNullOrEmpty()) { } else {
@foreach(var notification in Notification.UnreadNotifications) { }
}
@code { protected override Task OnInitializedAsync() { NewPushNotificationService.OnNotificationReceived += NewNotificationReceived; return Task.CompletedTask; } protected override async Task OnAfterRenderAsync(bool firstRender) { await JS.InvokeVoidAsync("initNotifications"); } private void NewNotificationReceived(PushNotificationDTO notification) { InvokeAsync(StateHasChanged); } }