Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
AddBundleProductsToCartInput,
} from '../../types/GraphQL';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

export default async (
context: Context,
Expand All @@ -27,5 +28,8 @@ export default async (
.mutate<any, AddBundleProductsToCartMutationVariables>({
mutation: addBundleProductsToCartGQL.query,
variables: addBundleProductsToCartGQL.variables,
context: {
headers: getHeaders(context),
},
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
AddConfigurableProductsToCartInput, AddConfigurableProductsToCartMutation, AddConfigurableProductsToCartMutationVariables,
} from '../../types/GraphQL';
import addConfigurableProductsToCartMutation from './addConfigurableProductsToCart';
import getHeaders from '../getHeaders';

/**
* Adds a set of configurable products to a specified cart
Expand All @@ -29,5 +30,8 @@ export default async function addConfigurableProductsToCart(
return context.client.mutate<any, AddConfigurableProductsToCartMutationVariables>({
mutation: addConfigurableProductsToCartGQL.query,
variables: addConfigurableProductsToCartGQL.variables,
context: {
headers: getHeaders(context),
},
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
AddDownloadableProductsToCartMutationVariables,
} from '../../types/GraphQL';
import addDownloadableProductsToCartMutation from './addDownloadableProductsToCart';
import getHeaders from '../getHeaders';

/**
* Adds a set of downloadable products to a specified cart
Expand All @@ -31,5 +32,8 @@ export default async function addDownloadableProductsToCart(
return context.client.mutate<AddDownloadableProductsToCartMutation, AddDownloadableProductsToCartMutationVariables>({
mutation: addDownloadableProductsToCartGQL.query,
variables: addDownloadableProductsToCartGQL.variables,
context: {
headers: getHeaders(context),
},
});
}
4 changes: 4 additions & 0 deletions packages/api-client/src/api/addProductToWishList/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
AddProductsToWishlistMutationVariables,
} from '../../types/GraphQL';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

export default async (
context: Context,
Expand All @@ -24,5 +25,8 @@ export default async (
return context.client.mutate<AddProductsToWishlistMutation, AddProductsToWishlistMutationVariables>({
mutation: addProductsToWishlistGQL.query,
variables: addProductsToWishlistGQL.variables,
context: {
headers: getHeaders(context),
},
});
};
4 changes: 4 additions & 0 deletions packages/api-client/src/api/addProductsToCart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
AddProductsToCartMutation, CartItemInput,
} from '../../types/GraphQL';
import addProductsToCartMutation from './addProductsToCart';
import getHeaders from '../getHeaders';

export type AddProductsToCartInput = {
cartId: string;
Expand Down Expand Up @@ -34,5 +35,8 @@ export default async function addProductsToCart(
return context.client.mutate<AddProductsToCartMutation, AddProductsToCartInput>({
mutation: addProductsToCartGQL.query,
variables: addProductsToCartGQL.variables,
context: {
headers: getHeaders(context),
},
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
AddSimpleProductsToCartMutationVariables,
} from '../../types/GraphQL';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

export default async (
context: Context,
Expand All @@ -25,5 +26,8 @@ export default async (
return context.client.mutate<AddSimpleProductsToCartMutation, AddSimpleProductsToCartMutationVariables>({
mutation: addSimpleProductsToCartGQL.query,
variables: addSimpleProductsToCartGQL.variables,
context: {
headers: getHeaders(context),
},
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
AddVirtualProductsToCartMutationVariables,
} from '../../types/GraphQL';
import addVirtualProductsToCartMutation from './addVirtualProductsToCart';
import getHeaders from '../getHeaders';

/**
* Adds a set of virtual products to a specified cart
Expand All @@ -31,5 +32,8 @@ export default async function addVirtualProductsToCart(
return context.client.mutate<AddVirtualProductsToCartMutation, AddVirtualProductsToCartMutationVariables>({
mutation: addVirtualProductsToCartGQL.query,
variables: addVirtualProductsToCartGQL.variables,
context: {
headers: getHeaders(context),
},
});
}
4 changes: 4 additions & 0 deletions packages/api-client/src/api/applyCouponToCart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ApplyCouponToCartMutationVariables,
} from '../../types/GraphQL';
import applyCouponToCartMutation from './applyCouponToCart';
import getHeaders from '../getHeaders';

/**
* Applies a coupon to a given card
Expand All @@ -31,5 +32,8 @@ export default async function applyCouponToCart(
return context.client.mutate<ApplyCouponToCartMutation, ApplyCouponToCartMutationVariables>({
mutation: applyCouponToCartGQL.query,
variables: applyCouponToCartGQL.variables,
context: {
headers: getHeaders(context),
},
});
}
4 changes: 4 additions & 0 deletions packages/api-client/src/api/availableStores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
} from '../../types/GraphQL';
import availableStores from './availableStores';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

/**
* Returns list of available stores
Expand All @@ -24,5 +25,8 @@ export default async (

return context.client.query<AvailableStoresQuery>({
query: availableStoresGQL.query,
context: {
headers: getHeaders(context),
},
});
};
4 changes: 4 additions & 0 deletions packages/api-client/src/api/cart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CustomQuery } from '@vue-storefront/core';
import { Context } from '../../types/context';
import type { CartQuery, CartQueryVariables } from '../../types/GraphQL';
import cartQuery from './cart';
import getHeaders from '../getHeaders';

/**
* Fetches a cart by its ID
Expand All @@ -27,5 +28,8 @@ export default async function cart(
return context.client.query<CartQuery, CartQueryVariables>({
query: cartGQL.query,
variables: cartGQL.variables,
context: {
headers: getHeaders(context),
},
});
}
4 changes: 4 additions & 0 deletions packages/api-client/src/api/cartTotalQty/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CustomQuery } from '@vue-storefront/core';
import { CartQuery, CartQueryVariables } from '../../types/GraphQL';
import query from './cartTotalQty';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

export default async (
context: Context,
Expand All @@ -21,5 +22,8 @@ export default async (
return context.client.query<CartQuery, CartQueryVariables>({
query: cartTotalQty.query,
variables: cartTotalQty.variables,
context: {
headers: getHeaders(context),
},
});
};
4 changes: 4 additions & 0 deletions packages/api-client/src/api/categoryList/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CustomQuery } from '@vue-storefront/core';
import { CategoryListQuery, CategoryListQueryVariables } from '../../types/GraphQL';
import categoryListQuery from './categoryList';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

/**
* Fetches the category list.
Expand All @@ -26,5 +27,8 @@ export default async function categoryList(
return context.client.query<CategoryListQuery, CategoryListQueryVariables>({
query: categoryListGQL.query,
variables: categoryListGQL.variables,
context: {
headers: getHeaders(context),
},
});
}
4 changes: 4 additions & 0 deletions packages/api-client/src/api/categorySearch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CustomQuery } from '@vue-storefront/core';
import { CategorySearchQuery, CategorySearchQueryVariables } from '../../types/GraphQL';
import categorySearchQuery from './categorySearch';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

/**
* Searches for categories using received filters.
Expand All @@ -28,5 +29,8 @@ export default async function categorySearch(
return context.client.query<CategorySearchQuery, CategorySearchQueryVariables>({
query: categorySearchGQL.query,
variables: categorySearchGQL.variables,
context: {
headers: getHeaders(context),
},
});
}
4 changes: 4 additions & 0 deletions packages/api-client/src/api/changeCustomerPassword/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ChangeCustomerPasswordMutationVariables,
} from '../../types/GraphQL';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

/**
* Changes password of the current customer. To override the default query, use the `changeCustomerPassword` query key.
Expand All @@ -29,6 +30,9 @@ export default async (
.mutate<ChangeCustomerPasswordMutation, ChangeCustomerPasswordMutationVariables>({
mutation: changeCustomerPasswordGQL.query,
variables: changeCustomerPasswordGQL.variables,
context: {
headers: getHeaders(context),
},
});
} catch (error) {
// For error in data we don't throw 500, because it's not server error
Expand Down
4 changes: 4 additions & 0 deletions packages/api-client/src/api/cmsBlocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CustomQuery } from '@vue-storefront/core';
import { CmsBlockQuery, CmsBlockQueryVariables } from '../../types/GraphQL';
import cmsBlocks from './cmsBlocks';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

/**
* Fetch CMS Blocks from Magento Api.
Expand All @@ -28,5 +29,8 @@ export default async function getCmsBlocks(
return context.client.query<CmsBlockQuery, CmsBlockQueryVariables>({
query: cmsBlocksGQL.query,
variables: cmsBlocksGQL.variables,
context: {
headers: getHeaders(context),
},
});
}
4 changes: 4 additions & 0 deletions packages/api-client/src/api/cmsPage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CustomQuery, Logger } from '@vue-storefront/core';
import { CmsPageQueryVariables, CmsPageQuery } from '../../types/GraphQL';
import cmsPage from './cmsPage';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

/**
* Fetch CMS Page from Magento
Expand Down Expand Up @@ -30,6 +31,9 @@ export default async function getCmsPage(
.query<CmsPageQuery, CmsPageQueryVariables>({
query: cmsPageGQL.query,
variables: cmsPageGQL.variables,
context: {
headers: getHeaders(context),
},
});
} catch (error) {
// For error in data we don't throw 500, because it's not server error
Expand Down
4 changes: 4 additions & 0 deletions packages/api-client/src/api/countries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CustomQuery } from '@vue-storefront/core';
import { CountriesListQuery } from '../../types/GraphQL';
import countriesListQuery from './countriesList';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

/**
* Loads the list of countries
Expand All @@ -23,5 +24,8 @@ export default async function countries(
);
return context.client.query<CountriesListQuery>({
query: countriesGQL.query,
context: {
headers: getHeaders(context),
},
});
}
4 changes: 4 additions & 0 deletions packages/api-client/src/api/country/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CustomQuery } from '@vue-storefront/core';
import { CountryInformationQuery, CountryInformationQueryVariables } from '../../types/GraphQL';
import countryInformation from './countryInformation';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

/**
* Fetches the information about a country given its ID
Expand All @@ -27,5 +28,8 @@ export default async function country(
return context.client.query<CountryInformationQuery, CountryInformationQueryVariables>({
query: countryGQL.query,
variables: countryGQL.variables,
context: {
headers: getHeaders(context),
},
});
}
8 changes: 5 additions & 3 deletions packages/api-client/src/api/createCustomer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '../../types/GraphQL';
import createCustomer from './createCustomer';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

/**
* Registers a new customer. To override the default query, use the `createCustomer` query key.
Expand Down Expand Up @@ -47,11 +48,12 @@ export default async (
},
);

return await context
.client
.mutate<CreateCustomerMutation, CreateCustomerMutationVariables>({
return await context.client.mutate<CreateCustomerMutation, CreateCustomerMutationVariables>({
mutation: createCustomerGQL.query,
variables: createCustomerGQL.variables,
context: {
headers: getHeaders(context),
},
});
} catch (error) {
// For error in data we don't throw 500, because it's not server error
Expand Down
4 changes: 4 additions & 0 deletions packages/api-client/src/api/createCustomerAddress/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
CustomerAddressInput,
} from '../../types/GraphQL';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

/**
* Creates a customer address.
Expand All @@ -33,5 +34,8 @@ export default async function createCustomerAddress(
return context.client.mutate<CreateCustomerAddressMutation, CreateCustomerAddressMutationVariables>({
mutation: createCustomerAddressGQL.query,
variables: createCustomerAddressGQL.variables,
context: {
headers: getHeaders(context),
},
});
}
4 changes: 4 additions & 0 deletions packages/api-client/src/api/createEmptyCart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CustomQuery } from '@vue-storefront/core';
import { CreateEmptyCartMutation } from '../../types/GraphQL';
import createEmptyCart from './createEmptyCart';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

export default async (
context: Context,
Expand All @@ -19,5 +20,8 @@ export default async (

return context.client.mutate<CreateEmptyCartMutation>({
mutation: createEmptyCartGQL.query,
context: {
headers: getHeaders(context),
},
});
};
4 changes: 4 additions & 0 deletions packages/api-client/src/api/createProductReview/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { CreateProductReviewMutation, CreateProductReviewInput } from '../../typ
import createProductReview from './createProductReview';
import { Context } from '../../types/context';
import recaptchaValidator from '../../helpers/recaptcha/recaptchaValidator';
import getHeaders from '../getHeaders';

/**
* Creates a new product review
Expand Down Expand Up @@ -45,5 +46,8 @@ export default async (
return context.client.mutate<CreateProductReviewMutation, { input: CreateProductReviewInput }>({
mutation: createProductReviewGQL.query,
variables: createProductReviewGQL.variables,
context: {
headers: getHeaders(context),
},
});
};
4 changes: 4 additions & 0 deletions packages/api-client/src/api/currency/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CustomQuery } from '@vue-storefront/core';
import { CurrencyQuery } from '../../types/GraphQL';
import currencyQuery from './currency';
import { Context } from '../../types/context';
import getHeaders from '../getHeaders';

/**
* Fetches the currency information.
Expand All @@ -22,5 +23,8 @@ export default async function currency(

return context.client.query<CurrencyQuery>({
query: currencyGQL.query,
context: {
headers: getHeaders(context),
},
});
}
Loading