From 8ceef31785db6922cc5915e592698a414a033e74 Mon Sep 17 00:00:00 2001 From: ncoronel Date: Mon, 6 Jul 2026 15:04:09 -0300 Subject: [PATCH] feat(checkout): implement ngOnInit lifecycle hook to load cart data --- .../store/pages/checkout-page/checkout-page.component.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/features/store/pages/checkout-page/checkout-page.component.ts b/src/app/features/store/pages/checkout-page/checkout-page.component.ts index e8647b7..197b53e 100644 --- a/src/app/features/store/pages/checkout-page/checkout-page.component.ts +++ b/src/app/features/store/pages/checkout-page/checkout-page.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, computed, inject, signal, ViewChild } from '@angular/core'; +import { ChangeDetectionStrategy, Component, computed, inject, OnInit, signal, ViewChild } from '@angular/core'; import { FormBuilder, Validators } from '@angular/forms'; import { Router } from '@angular/router'; import { startWith } from 'rxjs'; @@ -30,7 +30,7 @@ import { CheckoutForm, PaymentMethod, PaymentMethodOption, TransferAccount, Tran styleUrl: './checkout-page.component.scss', changeDetection: ChangeDetectionStrategy.OnPush }) -export class CheckoutPageComponent { +export class CheckoutPageComponent implements OnInit { private readonly formBuilder = inject(FormBuilder); private readonly cartService = inject(CartService); private readonly router = inject(Router); @@ -100,6 +100,10 @@ export class CheckoutPageComponent { } } + ngOnInit(): void { + this.cartService.loadCart().subscribe(); + } + private mapCartItemToMock(item: CartItem): CartItemMock { const fullName = item.product?.nombre ?? ''; let product = fullName;