Skip to content

Commit

Permalink
Merge pull request #288 from fpdrozd/feat/localization
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalcymerys authored Mar 16, 2023
2 parents 3ce9833 + 8399d7a commit 6196277
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@spree/axios-fetcher": "^1.0.0",
"@spree/storefront-api-v2-sdk": "6.0.2",
"@spree/storefront-api-v2-sdk": "6.0.3",
"@vue-storefront/core": "^2.5.0"
},
"files": [
Expand Down
9 changes: 7 additions & 2 deletions packages/api-client/src/api/getCategory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ import { deserializeCategories } from '../serializers/category';

const findCategory = (categories: Category[], slug: string) => categories.find(e => e.slug === slug);

export default async function getCategory({ client }: ApiContext, { categorySlug }: GetCategoryParams): Promise<CategorySearchResult> {
const result = await client.taxons.list({ fields: { taxon: 'name,permalink,children,parent,is_root' }, per_page: 500 });
export default async function getCategory({ client, config }: ApiContext, { categorySlug }: GetCategoryParams): Promise<CategorySearchResult> {
const locale = await config.internationalization.getLocale();
const result = await client.taxons.list({
fields: { taxon: 'name,permalink,children,parent,is_root' },
per_page: 500,
locale
});

if (result.isSuccess()) {
try {
Expand Down
4 changes: 3 additions & 1 deletion packages/api-client/src/api/getProduct/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { addHostToProductImages, deserializeSingleProductVariants } from '../ser

export default async function getProduct({ client, config }: ApiContext, { slug }: GetProductParams): Promise<ProductVariant[]> {
const currency = await config.internationalization.getCurrency();
const locale = await config.internationalization.getLocale();

let include;

Expand All @@ -21,7 +22,8 @@ export default async function getProduct({ client, config }: ApiContext, { slug
variant: 'sku,price,display_price,in_stock,product,images,option_values,is_master'
},
include,
currency
currency,
locale
}
);

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3133,10 +3133,10 @@
resolved "https://registry.yarnpkg.com/@spree/axios-fetcher/-/axios-fetcher-1.0.0.tgz#d990ed38ee8bc33706f196a797f90117f8bd4d6d"
integrity sha512-mflTBxdhiYAlVvHqZnzsDOs2w4e3CDIUTa4SvK6X9jZy7VhWhPocS9u8Zo8nsLm77kus2oeq3jcZljbEJEbEhw==

"@spree/storefront-api-v2-sdk@6.0.2":
version "6.0.2"
resolved "https://registry.yarnpkg.com/@spree/storefront-api-v2-sdk/-/storefront-api-v2-sdk-6.0.2.tgz#67470a750a26f5c8cddf5b78be90d483aa06832f"
integrity sha512-zcMGuyyqaotGWE4ymkRNFrTddzSjbJ29yvTkeUxpunYFf1ZfwwxWJvGXC7TbdIwIBmIBGMdTxb/wWCh8qUmzRw==
"@spree/storefront-api-v2-sdk@6.0.3":
version "6.0.3"
resolved "https://registry.yarnpkg.com/@spree/storefront-api-v2-sdk/-/storefront-api-v2-sdk-6.0.3.tgz#b04886216258fe6565ca0af3fb84b6e7818d6c44"
integrity sha512-C2aoaGzQqJRBFxipxecDOk3Sy6auzJsVsqVgJuUJyfkf6vtb78U3sqJPZ80S8XrlnCaw2M6an+Hm5uDW1byzqA==

"@storefront-ui/shared@0.11.0":
version "0.11.0"
Expand Down

0 comments on commit 6196277

Please sign in to comment.