mirror of
https://github.com/vercel/commerce.git
synced 2025-06-20 06:01:21 +00:00
saleor: integrate collections
This commit is contained in:
parent
9ca6c38755
commit
f5ec8e17a4
@ -45,7 +45,7 @@ export const handler: SWRHook<
|
|||||||
let edges
|
let edges
|
||||||
|
|
||||||
if (categoryId) {
|
if (categoryId) {
|
||||||
edges = data.node?.products?.edges ?? []
|
edges = data.collection?.products?.edges ?? []
|
||||||
// FIXME @zaiste, no `vendor` in Saleor
|
// FIXME @zaiste, no `vendor` in Saleor
|
||||||
// if (brandId) {
|
// if (brandId) {
|
||||||
// edges = edges.filter(
|
// edges = edges.filter(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { SaleorConfig } from '../api'
|
import { SaleorConfig } from '../api'
|
||||||
import { Collection, CollectionCountableEdge } from '../schema'
|
import { CollectionCountableEdge } from '../schema'
|
||||||
import { getSiteCollectionsQuery } from './queries/'
|
import { getSiteCollectionsQuery } from './queries/'
|
||||||
|
|
||||||
export type Category = {
|
export type Category = {
|
||||||
|
@ -3,21 +3,15 @@ import { productConnection } from './get-all-products-query'
|
|||||||
export const getCollectionProductsQuery = /* GraphQL */ `
|
export const getCollectionProductsQuery = /* GraphQL */ `
|
||||||
query getProductsFromCollection(
|
query getProductsFromCollection(
|
||||||
$categoryId: ID!
|
$categoryId: ID!
|
||||||
$first: Int = 250
|
$first: Int = 100
|
||||||
$sortKey: ProductCollectionSortKeys = RELEVANCE
|
$channel: String = "default-channel"
|
||||||
$reverse: Boolean = false
|
|
||||||
) {
|
) {
|
||||||
node(id: $categoryId) {
|
collection(id: $categoryId, channel: $channel) {
|
||||||
id
|
id
|
||||||
... on Collection {
|
products(first: $first) {
|
||||||
products(
|
...productConnection
|
||||||
first: $first
|
|
||||||
sortKey: $sortKey
|
|
||||||
reverse: $reverse
|
|
||||||
) {
|
|
||||||
${productConnection}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
${productConnection}
|
||||||
`
|
`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user