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
3 changes: 2 additions & 1 deletion @ecomplus/storefront-app/src/components/js/EcCheckout.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ export default {

login (ecomPassport) {
if (ecomPassport.checkLogin()) {
this.customerEmail = ecomPassport.getCustomer().main_email
// don't set `customerEmail` here, the fetch may fail (401) and leave
// the buyer identified with e-mail only, as a new customer
this.$emit('login', ecomPassport)
}
},
Expand Down
9 changes: 8 additions & 1 deletion @ecomplus/storefront-app/src/views/js/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export default {
'selectPaymentGateway',
'setCustomer',
'selectAddress',
'addOrder'
'addOrder',
'resetAccount'
]),

...mapActions([
Expand All @@ -132,6 +133,12 @@ export default {
this.ecomPassport = ecomPassport
this.triggerLoading(true)
this.fetchCustomer({ ecomPassport })
.catch(() => {
if (!ecomPassport.checkLogin()) {
// `fetchCustomer` logs out on 401 (stale token)
this.resetAccount()
}
})
.finally(() => this.triggerLoading(false))
},

Expand Down
Loading