feat: enhance product detail page to support default variant selection from query parameters

This commit is contained in:
2026-06-30 15:07:01 -03:00
parent 8d9a828df0
commit b7420c2110
3 changed files with 55 additions and 15 deletions

View File

@@ -35,9 +35,14 @@ export class CatalogService {
);
}
getProducto(id: number): Observable<ProductDetail> {
getProducto(id: number, defaultVariantId?: number): Observable<ProductDetail> {
const params =
defaultVariantId === undefined
? undefined
: new HttpParams({ fromObject: { default_variant: defaultVariantId } });
return this.http
.get<ApiResponse<ProductDetail>>(`${this.tenantApiUrl}/productos/${id}`)
.get<ApiResponse<ProductDetail>>(`${this.tenantApiUrl}/productos/${id}`, { params })
.pipe(map((response) => response.data));
}