feat: implement catalog service and product attribute selector component for product details
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
export interface ApiResponse<T> {
|
||||
data: T;
|
||||
message?: string;
|
||||
errors?: Record<string, string[]>;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,14 @@ export class CatalogService {
|
||||
);
|
||||
}
|
||||
|
||||
getProducto(id: number): Observable<ProductDetail> {
|
||||
getProducto(id: number, variantId?: number): Observable<ProductDetail> {
|
||||
let params = new HttpParams();
|
||||
if (variantId) {
|
||||
params = params.set('variant_id', variantId);
|
||||
}
|
||||
|
||||
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