From 16d288cfe87efdd60b4a3d19dad3de26c999ab9e Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Mon, 25 Jan 2021 21:31:25 +0100 Subject: [PATCH] Optimize preview image size --- framework/vendure/lib/normalize.ts | 4 ++-- framework/vendure/product/get-product.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/vendure/lib/normalize.ts b/framework/vendure/lib/normalize.ts index e7dcfc34a..2b8de0f8c 100644 --- a/framework/vendure/lib/normalize.ts +++ b/framework/vendure/lib/normalize.ts @@ -75,7 +75,7 @@ export function normalizeSearchResult(item: SearchResultFragment): Product { description: item.description, slug: item.slug, path: item.slug, - images: [{ url: item.productAsset?.preview || '' }], + images: [{ url: item.productAsset?.preview + '?preset=medium' || '' }], variants: [], price: { value: (item.priceWithTax as any).min / 100, @@ -100,7 +100,7 @@ export function normalizeCart(order: CartFragment): Cart { url: l.productVariant.product.slug, variantId: l.productVariant.id, productId: l.productVariant.productId, - images: [{ url: l.featuredAsset?.preview || '' }], + images: [{ url: l.featuredAsset?.preview + '?preset=thumb' || '' }], prices: [], })), } diff --git a/framework/vendure/product/get-product.ts b/framework/vendure/product/get-product.ts index 534225641..0e46028fd 100644 --- a/framework/vendure/product/get-product.ts +++ b/framework/vendure/product/get-product.ts @@ -74,7 +74,7 @@ async function getProduct({ }, options: product.optionGroups.map((og: any) => ({ displayName: og.name, - values: og.options.map((o: any) => ({ label: o.name + ' hello' })), + values: og.options.map((o: any) => ({ label: o.name })), })), }, }