saleor-dashboard/src/searches/useAttributeSearch.ts

34 lines
737 B
TypeScript
Raw Normal View History

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