Browse Source

[FIX] fetch data

Gogs 7 years ago
parent
commit
0f96486fac
3 changed files with 10 additions and 10 deletions
  1. 2 9
      src/App.vue
  2. 5 1
      src/store/actions.js
  3. 3 0
      src/store/index.js

+ 2 - 9
src/App.vue

@@ -49,17 +49,10 @@
             currency: 'getDefaultCurrency'
         }),
         methods: mapActions([
-            'fetchCompany',
-            'fetchProducts',
-            'fetchCustomers',
-            'fetchCurrencies',
-            'fetchRates'
+            'fetchData'
         ]),
         mounted() {
-            this.fetchCompany()
-            this.fetchProducts()
-            this.fetchCustomers()
-            this.fetchCurrencies()
+            this.fetchData()
         }
     }
 </script>

+ 5 - 1
src/store/actions.js

@@ -1,8 +1,12 @@
 const actions = {
-    getData({ dispatch }) {
+    fetchData({ dispatch }) {
         dispatch('fetchCompany')
         dispatch('fetchCurrencies')
         dispatch('fetchProducts')
         dispatch('fetchCustomers')
     }
+}
+
+export default {
+    actions
 }

+ 3 - 0
src/store/index.js

@@ -1,6 +1,8 @@
 import Vue from 'vue'
 import Vuex from 'vuex'
 
+import actions from '@/store/actions'
+
 import company from '@/store/modules/company'
 import currencies from '@/store/modules/currencies'
 import products from '@/store/modules/products'
@@ -10,6 +12,7 @@ import customers from '@/store/modules/customers'
 Vue.use(Vuex)
 
 const Store = new Vuex.Store({
+    ...actions,
     modules: {
         company,
         currencies,