diff --git a/test/App.test.js b/test/App.test.js index 2574780..7e5f241 100644 --- a/test/App.test.js +++ b/test/App.test.js @@ -7,20 +7,21 @@ localVue.use(Vuex) describe('App.test.js', () => { let store - let actions + let mutations let wrapper beforeEach(() => { - actions = { - getCustomerData: jest.fn() + mutations = { + setItem: jest.fn() } store = new Vuex.Store({ - actions + mutations }) wrapper = shallowMount(App, { computed: { - isCustomerLoggedIn: () => true + isCustomerLoggedIn: () => true, + customerData: () => null }, store, localVue diff --git a/view/frontend/web/js/App.vue b/view/frontend/web/js/App.vue index a5f94f5..7829b6f 100644 --- a/view/frontend/web/js/App.vue +++ b/view/frontend/web/js/App.vue @@ -33,11 +33,17 @@ export default { computed: { isCustomerLoggedIn () { return this.$store.getters.isCustomerLoggedIn + }, + customerData () { + return window.config.customerData } }, mounted () { if (this.isCustomerLoggedIn) { - this.$store.dispatch('getCustomerData') + this.$store.commit('setItem', { + item: 'customer', + value: this.customerData + }) } } } diff --git a/view/frontend/web/js/components/AddressData.vue b/view/frontend/web/js/components/AddressData.vue index 4cced4e..374fa67 100644 --- a/view/frontend/web/js/components/AddressData.vue +++ b/view/frontend/web/js/components/AddressData.vue @@ -1,10 +1,15 @@