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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add translation key for add review - @gibkigonzo (#3611)
- Add product name prop to reviews component - @gibkigonzo (#3607)
- Show default cms pages when current store code is not equals to default - @andrzejewsky (#3579)
- Fix login errors with mailchimp - @gibkigonzo (#3612)
- Hydration error on homepage - @patzick (#3609)

### Changed / Improved
Expand Down
3 changes: 2 additions & 1 deletion core/data-resolver/NewsletterService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const isSubscribed = (email: string): Promise<boolean> =>
method: 'GET',
headers: { 'Content-Type': 'application/json' },
mode: 'cors'
}
},
silent: true
}).then(({ result }) => result === 'subscribed')

const subscribe = (email: string): Promise<boolean> =>
Expand Down
6 changes: 3 additions & 3 deletions core/lib/sync/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function _sleep (time) {
}

function _internalExecute (resolve, reject, task: Task, currentToken, currentCartId) {
if (currentToken !== null && rootStore.state.userTokenInvalidateLock > 0) { // invalidate lock set
if (currentToken && rootStore.state.userTokenInvalidateLock > 0) { // invalidate lock set
Logger.log('Waiting for rootStore.state.userTokenInvalidateLock to release for ' + task.url, 'sync')()
_sleep(1000).then(() => {
Logger.log('Another try for rootStore.state.userTokenInvalidateLock for ' + task.url, 'sync')()
Expand All @@ -42,7 +42,7 @@ function _internalExecute (resolve, reject, task: Task, currentToken, currentCar
return // return but not resolve
} else if (rootStore.state.userTokenInvalidateLock < 0) {
Logger.error('Aborting the network task' + task.url + rootStore.state.userTokenInvalidateLock, 'sync')()
resolve({ code: 401, message: i18n.t('Error refreshing user token. User is not authorized to access the resource') })()
resolve({ code: 401, result: i18n.t('Error refreshing user token. User is not authorized to access the resource') })()
return
} else {
if (rootStore.state.userTokenInvalidated) {
Expand Down Expand Up @@ -75,7 +75,7 @@ function _internalExecute (resolve, reject, task: Task, currentToken, currentCar
if (jsonResponse) {
const responseCode = parseInt(jsonResponse.code)
if (responseCode !== 200) {
if (responseCode === 401 /** unauthorized */ && currentToken !== null) { // the token is no longer valid, try to invalidate it
if (responseCode === 401 /** unauthorized */ && currentToken) { // the token is no longer valid, try to invalidate it
Logger.error('Invalid token - need to be revalidated' + currentToken + task.url + rootStore.state.userTokenInvalidateLock, 'sync')()
if (isNaN(rootStore.state.userTokenInvalidateAttemptsCount) || isUndefined(rootStore.state.userTokenInvalidateAttemptsCount)) rootStore.state.userTokenInvalidateAttemptsCount = 0
if (isNaN(rootStore.state.userTokenInvalidateLock) || isUndefined(rootStore.state.userTokenInvalidateLock)) rootStore.state.userTokenInvalidateLock = 0
Expand Down
2 changes: 1 addition & 1 deletion core/modules/cart/store/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import mergeActions from './mergeActions';
import methodsActions from './methodsActions'
import productActions from './productActions'
import quantityActions from './quantityActions'
import synchronizeActions from './syncrhonizeActions'
import synchronizeActions from './synchronizeActions'
import totalsActions from './totalsActions'

const actions: ActionTree<CartState, RootState> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CartService } from '@vue-storefront/core/data-resolver'
import { createDiffLog } from '@vue-storefront/core/modules/cart/helpers'
import i18n from '@vue-storefront/i18n'
import EventBus from '@vue-storefront/core/compatibility/plugins/event-bus'
import { cartHooksExecutors } from './../../hooks'
import { cartHooksExecutors } from '../../hooks'

const synchronizeActions = {
async load ({ commit, dispatch }, { forceClientState = false }: {forceClientState?: boolean} = {}) {
Expand Down
4 changes: 2 additions & 2 deletions core/modules/catalog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export const CatalogModule: StorefrontModule = async function (app, store, route
EventBus.$on('product-after-bundleoptions', payload => productAfterBundleoptions(payload, store))

if (config.usePriceTiers || store.getters['tax/getIsUserGroupedTaxActive']) {
EventBus.$on('user-after-loggedin', onUserPricesRefreshed(store, router))
EventBus.$on('user-after-logout', onUserPricesRefreshed(store, router))
EventBus.$on('user-after-loggedin', onUserPricesRefreshed.bind(null, store, router))
EventBus.$on('user-after-logout', onUserPricesRefreshed.bind(null, store, router))
}
}
}
4 changes: 2 additions & 2 deletions core/modules/user/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const actions: ActionTree<UserState, RootState> = {
commit(types.USER_INFO_LOADED, currentUser)
await dispatch('setUserGroup', currentUser)
EventBus.$emit('user-after-loggedin', currentUser)
await dispatch('cart/authorize', {}, { root: true })
dispatch('cart/authorize', {}, { root: true })

return currentUser
}
Expand All @@ -126,7 +126,7 @@ const actions: ActionTree<UserState, RootState> = {

if (!resolvedFromCache && resp.resultCode === 200) {
EventBus.$emit('user-after-loggedin', resp.result)
await dispatch('cart/authorize', {}, { root: true })
dispatch('cart/authorize', {}, { root: true })
return resp
}
},
Expand Down