Implemented cart hydration and refactored paynow flow
continuous-integration/drone/pr Build is passing

This commit is contained in:
Khwezi Mngoma
2026-06-15 16:42:09 +02:00
parent 11e0176e40
commit 7199a6651b
7 changed files with 185 additions and 55 deletions
@@ -27,13 +27,9 @@ public partial class MainLayout(CartService cartService) : IDisposable
Navigation.LocationChanged += OnLocationChanged;
cartService.OnCartChanged += CartService_OnCartChanged;
SyncSearchQueryFromUrl();
}
await cartService.LoadCartFromStorageAsync();
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
await cartService.LoadCartFromStorageAsync();
SyncSearchQueryFromUrl();
}
private async void CartService_OnCartChanged() => await InvokeAsync(StateHasChanged);
@@ -104,7 +100,7 @@ public partial class MainLayout(CartService cartService) : IDisposable
private void ToggleCart() => IsCartOpen = !IsCartOpen;
private async void ChangeQuantity(CartItem item, int delta)
private async Task ChangeQuantity(CartItem item, int delta)
{
var peekQuantity = item.Quantity + delta;
@@ -115,7 +111,7 @@ public partial class MainLayout(CartService cartService) : IDisposable
await cartService.SaveCartToStorageAsync();
}
private async void RemoveFromCart(CartItem item)
private async Task RemoveFromCart(CartItem item)
{
cartService.RemoveOneItem(item.Price!.Id);