Skip to content

Commit

Permalink
fix(ES-549): categories type (#1525)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszjedrasik authored May 10, 2024
1 parent 101d990 commit 3065ee7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-papayas-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vue-storefront/magento-api": patch
---

[ADDED] `CategoriesQuery` type for `categories` endpoint.
6 changes: 4 additions & 2 deletions packages/api-client/src/api/categories/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import categoriesQuery from "./categories";
import { Context } from "../../types/context";
import getHeaders from "../getHeaders";

export type CategoriesQuery = Required<Pick<Query, "categories">>;

/**
* Fetch list of all categories matching specified filters
*
Expand Down Expand Up @@ -64,15 +66,15 @@ export async function categories(
params: QueryCategoriesArgs,
customQuery: CustomQuery = { categories: "categories" },
customHeaders: CustomHeaders = {}
): Promise<ApolloQueryResult<Query["categories"]>> {
): Promise<ApolloQueryResult<CategoriesQuery>> {
const { categories: categoriesGQL } = context.extendQuery(customQuery, {
categories: {
query: categoriesQuery,
variables: { ...params },
},
});

return context.client.query<Query["categories"], QueryCategoriesArgs>({
return context.client.query<CategoriesQuery, QueryCategoriesArgs>({
query: gql`
${categoriesGQL.query}
`,
Expand Down

0 comments on commit 3065ee7

Please sign in to comment.