2019-06-19 14:40:52 +00:00
|
|
|
import gql from "graphql-tag";
|
|
|
|
|
2019-11-19 16:04:53 +00:00
|
|
|
import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch";
|
2019-10-15 12:17:35 +00:00
|
|
|
import { pageInfoFragment } from "@saleor/queries";
|
2019-06-19 14:40:52 +00:00
|
|
|
import {
|
|
|
|
SearchCollections,
|
|
|
|
SearchCollectionsVariables
|
|
|
|
} from "./types/SearchCollections";
|
|
|
|
|
|
|
|
export const searchCollections = gql`
|
2019-10-15 12:17:35 +00:00
|
|
|
${pageInfoFragment}
|
2019-06-19 14:40:52 +00:00
|
|
|
query SearchCollections($after: String, $first: Int!, $query: String!) {
|
2020-01-09 11:13:24 +00:00
|
|
|
search: collections(
|
|
|
|
after: $after
|
|
|
|
first: $first
|
|
|
|
filter: { search: $query }
|
|
|
|
) {
|
2019-06-19 14:40:52 +00:00
|
|
|
edges {
|
|
|
|
node {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
2019-10-15 12:17:35 +00:00
|
|
|
pageInfo {
|
|
|
|
...PageInfoFragment
|
|
|
|
}
|
2019-06-19 14:40:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2019-11-19 16:04:53 +00:00
|
|
|
export default makeTopLevelSearch<
|
|
|
|
SearchCollections,
|
|
|
|
SearchCollectionsVariables
|
|
|
|
>(searchCollections);
|