@page "/checkout" @attribute [Authorize] @inject OrderState OrderState @inject OrdersClient OrdersClient @inject NavigationManager NavigationManager @inject IJSRuntime JSRuntime

Bestellung überprüfen

Lieferaddresse...

@code { bool isSubmitting; protected override void OnInitialized() { // In the background, ask if they want to be notified about order updates _ = RequestNotificationSubscriptionAsync(); } async Task RequestNotificationSubscriptionAsync() { var subscription = await JSRuntime.InvokeAsync("blazorPushNotifications.requestSubscription"); if (subscription != null) { try { await OrdersClient.SubscribeToNotifications(subscription); } catch (AccessTokenNotAvailableException ex) { ex.Redirect(); } } } async Task PlaceOrder() { isSubmitting = true; try { var newOrderId = await OrdersClient.PlaceOrder(OrderState.Order); OrderState.ResetOrder(); NavigationManager.NavigateTo($"myorders/{newOrderId}"); } catch (AccessTokenNotAvailableException ex) { ex.Redirect(); } } }