Skip to content

Commit

Permalink
#68 - get customer data for logged in user
Browse files Browse the repository at this point in the history
  • Loading branch information
szafran89 committed Dec 19, 2018
1 parent d10466c commit 4998319
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions view/frontend/web/js/components/steps/TheShippingStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ export default {
return this.baseUrl + 'customer/account/login/'
}
},
created () {
this.$store.dispatch('getCustomerAddresses')
},
methods: {
checkIsEmailAvailable () {
const options = {
Expand Down
11 changes: 11 additions & 0 deletions view/frontend/web/js/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ export default {
})
})
},
getCustomerAddresses ({ commit }) {
axios.get('customers/me')
.then(response => {
if (response.data) {
commit('setItem', {item: 'customer', value: response.data})
}
})
.catch(error => {
console.log('Looks like there was a problem: \n', error)
})
},
placeOrder ({commit, state, getters}, billingAddress) {
return new Promise((resolve, reject) => {
let url = `guest-carts/${getters.cartId}/payment-information`
Expand Down

0 comments on commit 4998319

Please sign in to comment.