Implemented cart hydration and refactored paynow flow
continuous-integration/drone/pr Build is passing
continuous-integration/drone/pr Build is passing
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user