saleor-dashboard/src/searches/useCollectionSearch.ts
2020-07-07 12:14:12 +02:00

34 lines
748 B
TypeScript

import { pageInfoFragment } from "@saleor/fragments/pageInfo";
import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch";
import gql from "graphql-tag";
import {
SearchCollections,
SearchCollectionsVariables
} from "./types/SearchCollections";
export const searchCollections = gql`
${pageInfoFragment}
query SearchCollections($after: String, $first: Int!, $query: String!) {
search: collections(
after: $after
first: $first
filter: { search: $query }
) {
edges {
node {
id
name
}
}
pageInfo {
...PageInfoFragment
}
}
}
`;
export default makeTopLevelSearch<
SearchCollections,
SearchCollectionsVariables
>(searchCollections);