Skip to content

Commit

Permalink
fix(ct): handle error from ct create order from cart request (vuestor…
Browse files Browse the repository at this point in the history
…efront#6538)

* fix(ct): handle error from ct create order from cart request
  • Loading branch information
CheStas authored Jan 17, 2022
1 parent 86f67b3 commit 1ee759c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/commercetools/composables/src/useMakeOrder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ const useMakeOrderFactoryParams = {

make: async (context: Context, { customQuery }): Promise<Order> => {
const { id, version } = context.cart.cart.value;
const response = await context.$ct.api.createMyOrderFromCart({ id, version }, customQuery);
// TODO fix type in @vue-storefront/core after update apollo-client
const response: any = await context.$ct.api.createMyOrderFromCart({ id, version }, customQuery);
if (response.graphQLErrors) {
throw response.graphQLErrors[0];
}
if (response.networkError) {
throw response.networkError;
}
return response.data.order;
}
};
Expand Down

0 comments on commit 1ee759c

Please sign in to comment.