Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
samberrry committed Nov 8, 2022
2 parents 3009291 + 51e0722 commit 5b6317b
Show file tree
Hide file tree
Showing 4 changed files with 12 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
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/prestashop-api",
"version": "1.1.0",
"version": "1.1.1",
"private": false,
"sideEffects": false,
"server": "server/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/composables/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/prestashop",
"version": "1.1.0",
"version": "1.1.1",
"private": false,
"sideEffects": false,
"main": "lib/index.cjs.js",
Expand All @@ -16,7 +16,7 @@
"update:update": "ncu -u"
},
"dependencies": {
"@vue-storefront/prestashop-api": "1.1.0",
"@vue-storefront/prestashop-api": "1.1.1",
"@vue-storefront/core": "~2.5.4"
},
"devDependencies": {
Expand Down
10 changes: 7 additions & 3 deletions packages/theme/middleware/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ export default async ({ app, $vsf }) => {
const psCookieKey = $vsf.$prestashop.config.app.$cookies.get(vsfCookieKey);
const psCookieValue = $vsf.$prestashop.config.app.$cookies.get(vsfCookieValue);

const lang = $vsf.$prestashop.config.app.i18n.locales && $vsf.$prestashop.config.app.i18n.locales.length > 1 ? '/' + $vsf.$prestashop.config.app.$cookies.get('vsf-locale') : '';
const currency = $vsf.$prestashop.config.app.$cookies.get('vsf-currency');

switch (currentPath) {
case 'payment':
const customer = await $vsf.$prestashop.api.loadCustomer({key: psCookieKey, value: psCookieValue});
const customer = await $vsf.$prestashop.api.loadCustomer({key: psCookieKey, value: psCookieValue, lang: lang, currency: currency});

if (customer.code === 410) {
app.context.redirect('/checkout/user-account');
}

const { data } = await $vsf.$prestashop.api.getPaymentMethods({ psCookieKey, psCookieValue });
const { data } = await $vsf.$prestashop.api.getPaymentMethods({ psCookieKey, psCookieValue, lang: lang, currency: currency});

if (data.code === 200) {
if (Object.keys(data.psdata).length === 0) {
Expand All @@ -26,7 +30,7 @@ export default async ({ app, $vsf }) => {
}
break;
case 'shipping':
const result = await $vsf.$prestashop.api.loadCustomer({key: psCookieKey, value: psCookieValue});
const result = await $vsf.$prestashop.api.loadCustomer({key: psCookieKey, value: psCookieValue, lang: lang, currency: currency});
if (result.code === 410) {
app.context.redirect('/checkout/user-account');
}
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/prestashop-theme",
"version": "1.1.0",
"version": "1.1.1",
"private": true,
"scripts": {
"build": "nuxt build -m",
Expand All @@ -24,7 +24,7 @@
"@vue-storefront/middleware": "~2.5.4",
"@vue-storefront/nuxt": "~2.5.4",
"@vue-storefront/nuxt-theme": "~2.5.4",
"@vue-storefront/prestashop": "1.1.0",
"@vue-storefront/prestashop": "1.1.1",
"cookie-universal-nuxt": "^2.1.5",
"core-js": "^3.19.0",
"nuxt": "^2.15.8",
Expand Down

0 comments on commit 5b6317b

Please sign in to comment.