mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 03:31:23 +00:00
bug: fix favorite products
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Cart } from '@commerce/types/cart'
|
||||
import { ProductCard } from '@commerce/types/product'
|
||||
import { CartFragment, SearchResultFragment } from '../schema'
|
||||
import { CartFragment, SearchResultFragment,Favorite,ActiveCustomerQuery } from '../schema'
|
||||
|
||||
export function normalizeSearchResult(item: SearchResultFragment): ProductCard {
|
||||
return {
|
||||
@@ -21,6 +21,18 @@ export function normalizeSearchResult(item: SearchResultFragment): ProductCard {
|
||||
}
|
||||
}
|
||||
|
||||
export function normalizeFavoriteProductResult(item: Favorite) {
|
||||
return {
|
||||
id: item.product.id,
|
||||
name: item.product.name,
|
||||
slug: item.product.slug,
|
||||
imageSrc: item.product.assets[0].preview ? item.product.assets[0].preview + '?w=800&mode=crop' : '',
|
||||
price: item.product.variants[0].priceWithTax as number / 100,
|
||||
currencyCode: item.product.variants[0].currencyCode,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function normalizeCart(order: CartFragment): Cart {
|
||||
return {
|
||||
id: order.id.toString(),
|
||||
|
Reference in New Issue
Block a user