mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 21:51:21 +00:00
fix: page/product properties
This commit is contained in:
parent
89f6c1ce76
commit
5402af4902
@ -29,9 +29,9 @@ const getAllPages = async (options?: {
|
||||
const { data } = await config.fetch(getAllPagesQuery, { variables })
|
||||
|
||||
const pages = data.pages?.edges?.map(
|
||||
({ node: { title: name, handle, ...node } }: PageEdge) => ({
|
||||
({ node: { title: name, slug, ...node } }: PageCountableEdge) => ({
|
||||
...node,
|
||||
url: `/${locale}/${handle}`,
|
||||
url: `/${locale}/${slug}`,
|
||||
name,
|
||||
})
|
||||
)
|
||||
|
@ -21,14 +21,14 @@ const getPage = async (options: {
|
||||
const { data } = await config.fetch(getPageQuery, {
|
||||
variables,
|
||||
})
|
||||
const page = data.node
|
||||
const page = data.page
|
||||
|
||||
return {
|
||||
page: page
|
||||
? {
|
||||
...page,
|
||||
name: page.title,
|
||||
url: `/${locale}/${page.handle}`,
|
||||
url: `/${locale}/${page.slug}`,
|
||||
}
|
||||
: null,
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ const getAllProductPaths = async (options?: {
|
||||
return {
|
||||
products: products?.map(({ node: { slug } }: ProductCountableEdge) => ({
|
||||
node: {
|
||||
path: `/${handle}`,
|
||||
path: `/${slug}`,
|
||||
},
|
||||
})),
|
||||
}
|
||||
|
@ -1,13 +1,9 @@
|
||||
export const getPageQuery = /* GraphQL */ `
|
||||
query($id: ID!) {
|
||||
node(id: $id) {
|
||||
page(id: $id) {
|
||||
id
|
||||
... on Page {
|
||||
title
|
||||
handle
|
||||
body
|
||||
bodySummary
|
||||
}
|
||||
title
|
||||
slug
|
||||
}
|
||||
}
|
||||
`
|
||||
|
Loading…
x
Reference in New Issue
Block a user