Skip to content

Open source personal finance application

Add showCategoryModal action

ilkome0e19ba5f4ec1
diff --git a/src/components/categories/modal/CategoryModal.vue b/src/components/categories/modal/CategoryModal.vue
index a0927c55..cb1670fb 100644
--- a/src/components/categories/modal/CategoryModal.vue
+++ b/src/components/categories/modal/CategoryModal.vue
@@ -54,10 +54,6 @@ export default {
this.$store.commit('setFilterDateNow')
this.$store.dispatch('setFilterCategoryId', this.categoryId)
},
- handleCategoryClick (id) {
- this.$store.commit('showCategoryModal')
- this.$store.commit('setCategoryModalId', id)
- },
handleEditClick () {
const categoryId = this.categoryId
@@ -142,7 +138,7 @@ ModalBottom(
:borderTop="true"
:ids="childCategoriesIds"
:noPadding="true"
- v-on:onClick="handleCategoryClick")
+ v-on:onClick="id => $store.dispatch('showCategoryModal', id)")
ModalBottomConfirm(
:show="showModalConfirm"
diff --git a/src/components/categories/store/actions.js b/src/components/categories/store/actions.js
index fd99b299..71dccff0 100644
--- a/src/components/categories/store/actions.js
+++ b/src/components/categories/store/actions.js
@@ -19,5 +19,10 @@ export default {
unsubcribeCategories ({ rootState }) {
const uid = rootState.user.user.uid
db.ref(`users/${uid}/categories`).off()
+ },
+
+ showCategoryModal ({ commit }, id) {
+ commit('showCategoryModal')
+ commit('setCategoryModalId', id)
}
}
diff --git a/src/components/layout/LayoutPc.vue b/src/components/layout/LayoutPc.vue
index b8c023cf..45561185 100644
--- a/src/components/layout/LayoutPc.vue
+++ b/src/components/layout/LayoutPc.vue
@@ -41,10 +41,6 @@ export default {
},
methods: {
- handleShowCategoryModal (id) {
- this.$store.commit('showCategoryModal')
- this.$store.commit('setCategoryModalId', id)
- },
handleShowWalletModal (id) {
this.$store.commit('showWalletModal')
this.$store.commit('setWalletModalId', id)
@@ -75,7 +71,8 @@ export default {
//------------------------------------------------
LayoutPcTab(:show="activeTab === 'categories'")
.dashboard__title {{ $lang.categories.title }}
- CategoriesList.dashboardItems(v-on:onClick="(id) => handleShowCategoryModal(id)")
+ CategoriesList.dashboardItems(
+ v-on:onClick="id => $store.dispatch('showCategoryModal', id)")
Button(
className="_blue _inline"
icon="mdi mdi-plus"