62 lines
1.2 KiB
JavaScript
62 lines
1.2 KiB
JavaScript
import { ProductFragment } from './products.js';
|
|
|
|
// Get all collections
|
|
export const GET_COLLECTIONS_QUERY = `
|
|
query GetCollections($first: Int!) {
|
|
collections(first: $first) {
|
|
edges {
|
|
node {
|
|
id
|
|
title
|
|
handle
|
|
description
|
|
descriptionHtml
|
|
image {
|
|
id
|
|
url
|
|
altText
|
|
width
|
|
height
|
|
}
|
|
}
|
|
}
|
|
pageInfo {
|
|
hasNextPage
|
|
endCursor
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
// Get products in a collection
|
|
export const GET_COLLECTION_PRODUCTS_QUERY = `
|
|
${ProductFragment}
|
|
query GetCollectionProducts($handle: String!, $first: Int!, $sortKey: ProductCollectionSortKeys, $reverse: Boolean) {
|
|
collection(handle: $handle) {
|
|
id
|
|
title
|
|
handle
|
|
description
|
|
descriptionHtml
|
|
image {
|
|
id
|
|
url
|
|
altText
|
|
width
|
|
height
|
|
}
|
|
products(first: $first, sortKey: $sortKey, reverse: $reverse) {
|
|
edges {
|
|
node {
|
|
...ProductFragment
|
|
}
|
|
}
|
|
pageInfo {
|
|
hasNextPage
|
|
endCursor
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|