Skip to content

Commit 35ebca2

Browse files
bartoszherbaFrodigo
authored andcommitted
fix(api): fix cart_id graphql error
1 parent e629ffb commit 35ebca2

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

packages/api-client/src/api/cart/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default async (
1414
{
1515
cart: {
1616
query: cart,
17-
variables: { cartId },
17+
variables: { cartId: cartId ?? '' },
1818
},
1919
},
2020
);

packages/api-client/src/api/cartTotalQty/cartTotalQty.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import gql from 'graphql-tag';
22

33
export default gql`
4-
query cart($cartId: String!) {
4+
query cartTotalQty($cartId: String!) {
55
cart(cart_id:$cartId) {
66
total_quantity
77
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import { ApolloQueryResult } from '@apollo/client/core';
22
import { CustomQuery } from '@vue-storefront/core';
33
import { CartQuery, CartQueryVariables } from '../../types/GraphQL';
4-
import cart from './cartTotalQty';
4+
import query from './cartTotalQty';
55
import { Context } from '../../types/context';
66

77
export default async (
88
context: Context,
99
cartId: string,
10-
customQuery: CustomQuery = { cart: 'cart' },
10+
customQuery: CustomQuery = { cartTotalQty: 'cartTotalQty' },
1111
): Promise<ApolloQueryResult<CartQuery>> => {
12-
const { cart: cartGQL } = context.extendQuery(
12+
const { cartTotalQty } = context.extendQuery(
1313
customQuery,
1414
{
15-
cart: {
16-
query: cart,
17-
variables: { cartId },
15+
cartTotalQty: {
16+
query,
17+
variables: { cartId: cartId ?? '' },
1818
},
1919
},
2020
);
2121
return context.client.query<CartQuery, CartQueryVariables>({
22-
query: cartGQL.query,
23-
variables: cartGQL.variables,
22+
query: cartTotalQty.query,
23+
variables: cartTotalQty.variables,
2424
});
2525
};

0 commit comments

Comments
 (0)