mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 19:51:23 +00:00
🐛 bug: fix code follow by review Ly Tran
:%s
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Cart } from '@commerce/types/cart'
|
||||
import { ProductCard, Product } from '@commerce/types/product'
|
||||
import { CartFragment, SearchResultFragment,Favorite } from '../schema'
|
||||
import { CartFragment, SearchResultFragment,Favorite, BlogList } from '../schema'
|
||||
|
||||
export function normalizeSearchResult(item: SearchResultFragment): ProductCard {
|
||||
return {
|
||||
@@ -83,4 +83,19 @@ export function normalizeProductCard(product: Product): ProductCard {
|
||||
facetValueIds: product.facetValueIds,
|
||||
collectionIds: product.collectionIds,
|
||||
}
|
||||
}
|
||||
|
||||
export function normalizeBlogList(blog: BlogList) {
|
||||
return {
|
||||
id: blog.id,
|
||||
title: blog.translations[0]?.title,
|
||||
imageSrc: blog.featuredAsset?.preview ?? null,
|
||||
slug: blog.translations[0]?.slug,
|
||||
description: blog.translations[0]?.description,
|
||||
isPublish: blog.isPublish,
|
||||
isFeatured:blog.isFeatured,
|
||||
authorName: blog.authorName,
|
||||
authorAvatarAsset : blog.authorAvatarAsset?.preview,
|
||||
createdAt: blog.createdAt
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
export const getFeatuedBlogQuery = /* GraphQL */ `
|
||||
query GetFeaturedBlog($options: BlogListOptions) {
|
||||
export const getFeatuedBlogsQuery = /* GraphQL */ `
|
||||
query GetFeaturedBlogs($options: BlogListOptions) {
|
||||
featuredBlogs( options: $options){
|
||||
items {
|
||||
id
|
||||
|
Reference in New Issue
Block a user