feat: enhance product detail page to support default variant selection from query parameters
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user