@page "/sender"
@attribute [Microsoft.AspNetCore.Authorization.Authorize(Policy = "Sender")]
@using System.Text.Json
@using EnvelopeGenerator.ReceiverUI.Models
@inject EnvelopeGenerator.ReceiverUI.Services.EnvelopeService EnvelopeService
@inject IJSRuntime JSRuntime
Umschläge
Daten werden geladen und in der Konsole ausgegeben...
@code {
private IEnumerable? _activeEnvelopes;
private IEnumerable? _completedEnvelopes;
private static readonly JsonSerializerOptions _jsonOptions = new(JsonSerializerDefaults.Web);
protected override async Task OnInitializedAsync()
{
try
{
_activeEnvelopes = await EnvelopeService.GetAsync(onlyActive: true);
_completedEnvelopes = await EnvelopeService.GetAsync(onlyCompleted: true);
await JSRuntime.InvokeVoidAsync("console.log", "----- Aktive Umschläge -----");
await JSRuntime.InvokeVoidAsync("console.log", _activeEnvelopes);
await JSRuntime.InvokeVoidAsync("console.log", "----- Abgeschlossene Umschläge -----");
await JSRuntime.InvokeVoidAsync("console.log", _completedEnvelopes);
}
catch (Exception ex)
{
await JSRuntime.InvokeVoidAsync("console.error", "Fehler beim Laden der Umschläge:", ex.ToString());
}
}
}