saleor-dashboard/src/searches/useProductSearch.ts
Michał Droń 5dbd6fed8a
Fix assigning products to collection (#2320)
* Reset modal state in collection details

* cover initial state

* modal updates

* cover case when there is no items to add

Co-authored-by: andrzejewsky <vox3r69@gmail.com>
2022-09-21 15:35:05 +02:00

51 lines
1.1 KiB
TypeScript

import { gql } from "@apollo/client";
import {
SearchProductsDocument,
SearchProductsQuery,
SearchProductsQueryVariables,
} from "@saleor/graphql";
import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch";
export const searchProducts = gql`
query SearchProducts($after: String, $first: Int!, $query: String!) {
search: products(after: $after, first: $first, filter: { search: $query }) {
edges {
node {
id
name
thumbnail {
url
}
variants {
id
name
sku
channelListings {
channel {
id
isActive
name
currencyCode
}
price {
amount
currency
}
}
}
collections {
id
}
}
}
pageInfo {
...PageInfo
}
}
}
`;
export default makeTopLevelSearch<
SearchProductsQuery,
SearchProductsQueryVariables
>(SearchProductsDocument);