Skip to content

Firefly III: a personal finances manager

Fix store references

James Cole35a801674415
diff --cc config/firefly.php
index 0431fbad74,30f26e1881..4163106e38
--- a/config/firefly.php
+++ b/config/firefly.php
@@@ -608,10 -606,13 +608,13 @@@ return
AccountType::RECONCILIATION => TransactionTypeModel::RECONCILIATION,
],
AccountType::CASH => [
- AccountType::ASSET => TransactionTypeEnum::DEPOSIT->value,
+ AccountType::ASSET => TransactionTypeModel::DEPOSIT,
+ AccountType::LOAN => TransactionTypeModel::DEPOSIT,
+ AccountType::DEBT => TransactionTypeModel::DEPOSIT,
+ AccountType::MORTGAGE => TransactionTypeModel::DEPOSIT,
],
AccountType::DEBT => [
- AccountType::ASSET => TransactionTypeModel::DEPOSIT,
+ AccountType::ASSET => TransactionTypeEnum::DEPOSIT->value,
AccountType::DEBT => TransactionTypeModel::TRANSFER,
AccountType::EXPENSE => TransactionTypeModel::WITHDRAWAL,
AccountType::INITIAL_BALANCE => TransactionTypeModel::OPENING_BALANCE,
diff --cc frontend/src/pages/accounts/Index.vue
index 6061adb765,4891edb558..2e3fcc9de1
--- a/frontend/src/pages/accounts/Index.vue
+++ b/frontend/src/pages/accounts/Index.vue
@@@ -159,18 -156,18 +159,24 @@@ export default
},
mounted() {
this.type = this.$route.params.type;
-- if (null === this.getRange.start || null === this.getRange.end) {
++
++
++
++ if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update:
-- const $store = useStore();
-- $store.subscribe((mutation, state) => {
-- if ('fireflyiii/setRange' === mutation.type) {
-- this.range = {start: mutation.payload.start, end: mutation.payload.end};
-- this.triggerUpdate();
++ this.store.$onAction(
++ ({name, $store, args, after, onError,}) => {
++ after((result) => {
++ if (name === 'setRange') {
++ this.range = result;
++ this.triggerUpdate();
++ }
++ })
}
-- });
++ )
}
-- if (null !== this.getRange.start && null !== this.getRange.end) {
-- this.range = {start: this.getRange.start, end: this.getRange.end};
++ if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
++ this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate();
}
},
diff --cc frontend/src/pages/budgets/Index.vue
index 7ace02f6d5,29c3ef22b0..d7a3b73d78
--- a/frontend/src/pages/budgets/Index.vue
+++ b/frontend/src/pages/budgets/Index.vue
@@@ -168,7 -156,7 +168,7 @@@ export default
},
destroyBudget: function (id) {
(new Destroy('budgets')).destroy(id).then(() => {
- this.store.dispatch('fireflyiii/refreshCacheKey');
- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.triggerUpdate();
});
},
diff --cc frontend/src/pages/categories/Edit.vue
index 71a4dd48ab,71a4dd48ab..9738875db1
--- a/frontend/src/pages/categories/Edit.vue
+++ b/frontend/src/pages/categories/Edit.vue
@@@ -76,6 -76,6 +76,7 @@@
<script>
import Get from "../../api/categories/get";
import Put from "../../api/categories/put";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: "Edit",
@@@ -91,6 -91,6 +92,7 @@@
// category fields:
id: 0,
name: '',
++ store: null
}
},
computed: {
@@@ -101,6 -101,6 +103,7 @@@
created() {
this.id = parseInt(this.$route.params.id);
this.collectCategory();
++ this.store = useFireflyIIIStore();
},
methods: {
collectCategory: function() {
@@@ -144,7 -144,7 +147,7 @@@
this.errorMessage = '';
},
processSuccess: function (response) {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
if (!response) {
return;
}
diff --cc frontend/src/pages/categories/Index.vue
index 0694781cac,12f3436a14..dde616e249
--- a/frontend/src/pages/categories/Index.vue
+++ b/frontend/src/pages/categories/Index.vue
@@@ -87,9 -87,9 +87,10 @@@
</template>
<script>
-import {mapGetters, useStore} from "vuex";
+// import {mapGetters, useStore} from "vuex";
import Destroy from "../../api/generic/destroy";
import List from "../../api/categories/list";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: 'Index',
@@@ -118,6 -118,6 +119,7 @@@
{name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
++ store: null,
}
},
computed: {
@@@ -125,21 -125,21 +127,27 @@@
},
created() {
this.pagination.rowsPerPage = this.getListPageSize;
++ this.store = useFireflyIIIStore();
},
mounted() {
this.type = this.$route.params.type;
-- if (null === this.getRange.start || null === this.getRange.end) {
++ if (null === this.store.getRange.start || null === this.store.getRange.end) {
++
// subscribe, then update:
-- const $store = useStore();
-- $store.subscribe((mutation, state) => {
-- if ('fireflyiii/setRange' === mutation.type) {
-- this.range = {start: mutation.payload.start, end: mutation.payload.end};
-- this.triggerUpdate();
++ this.store.$onAction(
++ ({name, $store, args, after, onError,}) => {
++ after((result) => {
++ if (name === 'setRange') {
++ this.range = result;
++ this.triggerUpdate();
++ }
++ })
}
-- });
++ )
++
}
-- if (null !== this.getRange.start && null !== this.getRange.end) {
-- this.range = {start: this.getRange.start, end: this.getRange.end};
++ if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
++ this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate();
}
},
@@@ -156,7 -156,7 +164,7 @@@
},
destroyCategory: function (id) {
(new Destroy('categories')).destroy(id).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.triggerUpdate();
});
},
diff --cc frontend/src/pages/currencies/Create.vue
index a0daed33c4,a0daed33c4..b9a60f8436
--- a/frontend/src/pages/currencies/Create.vue
+++ b/frontend/src/pages/currencies/Create.vue
@@@ -97,6 -97,6 +97,7 @@@
<script>
import Post from "../../api/currencies/post";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: 'Create',
@@@ -113,6 -113,6 +114,7 @@@
name: '',
code: '',
symbol: '',
++ store: null,
}
},
computed: {
@@@ -123,6 -123,6 +125,7 @@@
created() {
this.resetForm();
this.type = this.$route.params.type;
++ this.store = useFireflyIIIStore();
},
methods: {
resetForm: function () {
@@@ -175,7 -175,7 +178,7 @@@
if (!response) {
return;
}
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.submitting = false;
let message = {
level: 'success',
diff --cc frontend/src/pages/currencies/Edit.vue
index 1a0bed598e,1a0bed598e..5ae88820a5
--- a/frontend/src/pages/currencies/Edit.vue
+++ b/frontend/src/pages/currencies/Edit.vue
@@@ -96,6 -96,6 +96,7 @@@
<script>
import Get from "../../api/currencies/get";
import Put from "../../api/currencies/put";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: "Edit",
@@@ -112,6 -112,6 +113,7 @@@
code: '',
name: '',
symbol: '',
++ store: null,
}
},
computed: {
@@@ -122,6 -122,6 +124,7 @@@
created() {
this.code = this.$route.params.code;
this.collectCurrency();
++ this.store = useFireflyIIIStore();
},
methods: {
collectCurrency: function() {
@@@ -172,7 -172,7 +175,7 @@@
this.errorMessage = '';
},
processSuccess: function (response) {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
if (!response) {
return;
}
diff --cc frontend/src/pages/currencies/Index.vue
index e175b44e6e,35c4e23814..53ce0d8d1c
--- a/frontend/src/pages/currencies/Index.vue
+++ b/frontend/src/pages/currencies/Index.vue
@@@ -87,9 -87,9 +87,10 @@@
</template>
<script>
-import {mapGetters, useStore} from "vuex";
+// import {mapGetters, useStore} from "vuex";
import Destroy from "../../api/generic/destroy";
import List from "../../api/currencies/list";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: 'Index',
@@@ -119,6 -119,6 +120,7 @@@
{name: 'name', label: 'Code', field: 'code', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
++ store: null,
}
},
computed: {
@@@ -126,21 -126,21 +128,27 @@@
},
created() {
this.pagination.rowsPerPage = this.getListPageSize;
++ this.store = useFireflyIIIStore();
},
mounted() {
this.type = this.$route.params.type;
-- if (null === this.getRange.start || null === this.getRange.end) {
++ if (null === this.store.getRange.start || null === this.store.getRange.end) {
++
// subscribe, then update:
-- const $store = useStore();
-- $store.subscribe((mutation, state) => {
-- if ('fireflyiii/setRange' === mutation.type) {
-- this.range = {start: mutation.payload.start, end: mutation.payload.end};
-- this.triggerUpdate();
++ this.store.$onAction(
++ ({name, $store, args, after, onError,}) => {
++ after((result) => {
++ if (name === 'setRange') {
++ this.range = result;
++ this.triggerUpdate();
++ }
++ })
}
-- });
++ )
++
}
-- if (null !== this.getRange.start && null !== this.getRange.end) {
-- this.range = {start: this.getRange.start, end: this.getRange.end};
++ if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
++ this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate();
}
},
@@@ -158,7 -158,7 +166,7 @@@
},
destroyCurrency: function (code) {
(new Destroy('currencies')).destroy(code).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.triggerUpdate();
});
},
diff --cc frontend/src/pages/dashboard/Boxes.vue
index 5190fee9ed,f9138a38f1..5cc300ecd0
--- a/frontend/src/pages/dashboard/Boxes.vue
+++ b/frontend/src/pages/dashboard/Boxes.vue
@@@ -125,26 -123,20 +125,26 @@@ export default
}
},
mounted() {
+ this.store = useFireflyIIIStore();
if (null === this.range.start || null === this.range.end) {
- // subscribe, then update:
+
+ // subscribe, then update:
- const $store = useStore();
- $store.subscribe((mutation) => {
- if ('fireflyiii/setRange' === mutation.type) {
- this.range = mutation.payload;
- this.triggerUpdate();
+ this.store.$onAction(
+ ({name, $store, args, after, onError,}) => {
+ after((result) => {
+ if (name === 'setRange') {
+ this.range = result;
+ this.triggerUpdate();
+ }
+ })
}
- });
+ )
}
- if (null !== this.getRange.start && null !== this.getRange.end) {
- this.start = this.getRange.start;
- this.end = this.getRange.end;
+
+ if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
+ this.start = this.store.getRange.start;
+ this.end = this.store.getRange.end;
this.triggerUpdate();
}
},
diff --cc frontend/src/pages/groups/Edit.vue
index e5d675bd92,e5d675bd92..8622de56c9
--- a/frontend/src/pages/groups/Edit.vue
+++ b/frontend/src/pages/groups/Edit.vue
@@@ -76,6 -76,6 +76,7 @@@
<script>
import Get from "../../api/groups/get";
import Put from "../../api/groups/put";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: "Edit",
@@@ -91,6 -91,6 +92,7 @@@
// group fields:
id: 0,
title: '',
++ store: null,
}
},
computed: {
@@@ -101,6 -101,6 +103,7 @@@
created() {
this.id = parseInt(this.$route.params.id);
this.collectGroup();
++ this.store = useFireflyIIIStore();
},
methods: {
collectGroup: function() {
@@@ -144,7 -144,7 +147,7 @@@
this.errorMessage = '';
},
processSuccess: function (response) {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
if (!response) {
return;
}
diff --cc frontend/src/pages/groups/Index.vue
index 19f5703c72,ba54d4d00a..c60715c2d6
--- a/frontend/src/pages/groups/Index.vue
+++ b/frontend/src/pages/groups/Index.vue
@@@ -71,9 -71,9 +71,10 @@@
</template>
<script>
-import {mapGetters, useStore} from "vuex";
+// import {mapGetters, useStore} from "vuex";
import Destroy from "../../api/generic/destroy";
import List from "../../api/groups/list";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: 'Index',
@@@ -101,7 -101,7 +102,8 @@@
columns: [
{name: 'title', label: 'Title', field: 'title', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
-- ]
++ ],
++ store: null
}
},
computed: {
@@@ -109,21 -109,21 +111,26 @@@
},
created() {
this.pagination.rowsPerPage = this.getListPageSize;
++ this.store = useFireflyIIIStore();
},
mounted() {
this.type = this.$route.params.type;
-- if (null === this.getRange.start || null === this.getRange.end) {
++ if (null === this.store.getRange.start || null === this.store.getRange.end) {
++
// subscribe, then update:
-- const $store = useStore();
-- $store.subscribe((mutation, state) => {
-- if ('fireflyiii/setRange' === mutation.type) {
-- this.range = {start: mutation.payload.start, end: mutation.payload.end};
-- this.triggerUpdate();
++ this.store.$onAction(
++ ({name, $store, args, after, onError,}) => {
++ after((result) => {
++ if (name === 'setRange') {
++ this.range = result;
++ this.triggerUpdate();
++ }
++ })
}
-- });
++ )
}
-- if (null !== this.getRange.start && null !== this.getRange.end) {
-- this.range = {start: this.getRange.start, end: this.getRange.end};
++ if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
++ this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate();
}
},
@@@ -141,7 -141,7 +148,7 @@@
},
destroyGroup: function (identifier) {
(new Destroy('object_groups')).destroy(identifier).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.triggerUpdate();
});
},
diff --cc frontend/src/pages/piggy-banks/Create.vue
index 023d07c06d,2a3af38b1b..7bf42269d3
--- a/frontend/src/pages/piggy-banks/Create.vue
+++ b/frontend/src/pages/piggy-banks/Create.vue
@@@ -104,8 -104,8 +104,8 @@@
<script>
import Post from "../../api/piggy-banks/post";
import List from "../../api/accounts/list";
-import {mapGetters} from "vuex";
-import {getCacheKey} from "../../store/fireflyiii/getters";
+// import {mapGetters} from "vuex";
- import {getCacheKey} from "../../store/fireflyiii/getters";
++// import {getCacheKey} from "../../store/fireflyiii/getters";
export default {
name: 'Create',
diff --cc frontend/src/pages/piggy-banks/Edit.vue
index b5ae682983,b5ae682983..176794c296
--- a/frontend/src/pages/piggy-banks/Edit.vue
+++ b/frontend/src/pages/piggy-banks/Edit.vue
@@@ -76,6 -76,6 +76,7 @@@
<script>
import Get from "../../api/piggy-banks/get";
import Put from "../../api/piggy-banks/put";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: "Edit",
@@@ -91,6 -91,6 +92,7 @@@
// piggy bank fields:
id: 0,
name: '',
++ store: null,
}
},
computed: {
@@@ -101,6 -101,6 +103,7 @@@
created() {
this.id = parseInt(this.$route.params.id);
this.collectPiggyBank();
++ this.store = useFireflyIIIStore();
},
methods: {
collectPiggyBank: function() {
@@@ -143,7 -143,7 +146,7 @@@
this.errorMessage = '';
},
processSuccess: function (response) {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
if (!response) {
return;
}
diff --cc frontend/src/pages/piggy-banks/Index.vue
index 4763c980ff,922904c412..2d4d1c9769
--- a/frontend/src/pages/piggy-banks/Index.vue
+++ b/frontend/src/pages/piggy-banks/Index.vue
@@@ -84,9 -84,9 +84,10 @@@
</template>
<script>
-import {mapGetters, useStore} from "vuex";
+// import {mapGetters, useStore} from "vuex";
import Destroy from "../../api/generic/destroy";
import List from "../../api/piggy-banks/list";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: 'Index',
@@@ -115,6 -115,6 +116,7 @@@
{name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
++ store: null,
}
},
computed: {
@@@ -122,20 -122,20 +124,24 @@@
},
created() {
this.pagination.rowsPerPage = this.getListPageSize;
++ this.store = useFireflyIIIStore();
},
mounted() {
-- if (null === this.getRange.start || null === this.getRange.end) {
++ if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update:
-- const $store = useStore();
-- $store.subscribe((mutation, state) => {
-- if ('fireflyiii/setRange' === mutation.type) {
-- this.range = {start: mutation.payload.start, end: mutation.payload.end};
-- this.triggerUpdate();
++ this.store.$onAction(
++ ({name, $store, args, after, onError,}) => {
++ after((result) => {
++ if (name === 'setRange') {
++ this.range = result;
++ this.triggerUpdate();
++ }
++ })
}
-- });
++ )
}
-- if (null !== this.getRange.start && null !== this.getRange.end) {
-- this.range = {start: this.getRange.start, end: this.getRange.end};
++ if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
++ this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate();
}
},
@@@ -152,7 -152,7 +158,7 @@@
},
destroyPiggyBank: function (id) {
(new Destroy('piggy_banks')).destroy(id).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.triggerUpdate();
});
},
diff --cc frontend/src/pages/preferences/Index.vue
index 0a72fd522b,e2f2fffce5..af7ffafc1b
--- a/frontend/src/pages/preferences/Index.vue
+++ b/frontend/src/pages/preferences/Index.vue
@@@ -147,11 -147,11 +147,13 @@@ import Configuration from "../../api/sy
import Put from "../../api/preferences/put";
import Preferences from "../../api/preferences";
import List from "../../api/accounts/list";
-import {mapGetters} from "vuex";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
+// import {mapGetters} from "vuex";
export default {
name: 'Index',
mounted() {
++ this.store = useFireflyIIIStore();
this.isOk = {
language: true,
accounts: true,
@@@ -225,7 -225,7 +227,8 @@@
date: [],
meta: [],
ref: []
-- }
++ },
++ store: null,
}
},
watch: {
@@@ -233,7 -233,7 +236,7 @@@
this.isOk.language = false;
this.isLoading.language = true;
(new Put).put('listPageSize', value).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.isOk.pageSize = true;
this.isLoading.pageSize = false;
this.isFailure.pageSize = false;
@@@ -256,7 -256,7 +259,7 @@@
this.isOk.language = false;
this.isLoading.language = true;
(new Put).put('language', value).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.isOk.language = true;
this.isLoading.language = false;
this.isFailure.language = false;
@@@ -268,7 -268,7 +271,7 @@@
},
accounts: function (value) {
(new Put).put('frontpageAccounts', value).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.isOk.accounts = true;
this.isLoading.accounts = false;
this.isFailure.accounts = false;
@@@ -280,7 -280,7 +283,7 @@@
},
viewRange: function (value) {
(new Put).put('viewRange', value).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.isOk.pageSize = true;
this.isLoading.pageSize = false;
this.isFailure.pageSize = false;
@@@ -328,7 -328,7 +331,7 @@@
}
}
(new Put).put('transaction_journal_optional_fields', submission).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.isOk.transactionFields = true;
this.isLoading.transactionFields = false;
this.isFailure.transactionFields = false;
diff --cc frontend/src/pages/recurring/Create.vue
index 58689454fa,10df57697b..6e785cde53
--- a/frontend/src/pages/recurring/Create.vue
+++ b/frontend/src/pages/recurring/Create.vue
@@@ -223,8 -223,8 +223,8 @@@
<script>
import Post from "../../api/recurring/post";
-import {mapGetters} from "vuex";
-import {getCacheKey} from "../../store/fireflyiii/getters";
+// import {mapGetters} from "vuex";
- import {getCacheKey} from "../../store/fireflyiii/getters";
++// import {getCacheKey} from "../../store/fireflyiii/getters";
import format from "date-fns/format";
import List from "../../api/accounts/list";
import {parseISO} from "date-fns";
diff --cc frontend/src/pages/recurring/Edit.vue
index f401a8dba5,f401a8dba5..16cf8d64b7
--- a/frontend/src/pages/recurring/Edit.vue
+++ b/frontend/src/pages/recurring/Edit.vue
@@@ -228,6 -228,6 +228,7 @@@ import Put from "../../api/recurring/pu
import {parseISO} from "date-fns";
import format from "date-fns/format";
import List from "../../api/accounts/list";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: "Edit",
@@@ -267,7 -267,7 +268,8 @@@
nr_of_repetitions: 0,
repeat_until: '',
repetitions: {},
-- transactions: {}
++ transactions: {},
++ store: null,
}
},
watch: {
@@@ -284,6 -284,6 +286,7 @@@
// TODO some forms use 'loading' others use 'submitting' or 'disabledInput', needs to be the same.
created() {
this.loading = true;
++ this.store = useFireflyIIIStore();
this.resetErrors();
this.resetForm();
this.getAccounts().then(() => {
@@@ -520,7 -520,7 +523,7 @@@
this.errorMessage = '';
},
processSuccess: function (response) {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
if (!response) {
return;
}
diff --cc frontend/src/pages/recurring/Index.vue
index 732ed1ad06,14eb398641..2d1eda8541
--- a/frontend/src/pages/recurring/Index.vue
+++ b/frontend/src/pages/recurring/Index.vue
@@@ -84,9 -84,9 +84,10 @@@
</template>
<script>
-import {mapGetters, useStore} from "vuex";
+// import {mapGetters, useStore} from "vuex";
import Destroy from "../../api/generic/destroy";
import List from "../../api/recurring/list";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: 'Index',
@@@ -115,6 -115,6 +116,7 @@@
{name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
++ store: null
}
},
computed: {
@@@ -122,21 -122,21 +124,25 @@@
},
created() {
this.pagination.rowsPerPage = this.getListPageSize;
++ this.store = useFireflyIIIStore();
},
mounted() {
this.type = this.$route.params.type;
-- if (null === this.getRange.start || null === this.getRange.end) {
++ if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update:
-- const $store = useStore();
-- $store.subscribe((mutation, state) => {
-- if ('fireflyiii/setRange' === mutation.type) {
-- this.range = {start: mutation.payload.start, end: mutation.payload.end};
-- this.triggerUpdate();
++ this.store.$onAction(
++ ({name, $store, args, after, onError,}) => {
++ after((result) => {
++ if (name === 'setRange') {
++ this.range = result;
++ this.triggerUpdate();
++ }
++ })
}
-- });
++ )
}
-- if (null !== this.getRange.start && null !== this.getRange.end) {
-- this.range = {start: this.getRange.start, end: this.getRange.end};
++ if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
++ this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate();
}
},
@@@ -153,7 -153,7 +159,7 @@@
},
destroyRecurring: function (id) {
(new Destroy('recurrences')).destroy(id).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.triggerUpdate();
});
},
diff --cc frontend/src/pages/rule-groups/Create.vue
index 5a3dbf9ed5,5bbe66c049..e93b11c8d5
--- a/frontend/src/pages/rule-groups/Create.vue
+++ b/frontend/src/pages/rule-groups/Create.vue
@@@ -75,8 -75,8 +75,8 @@@
<script>
import Post from "../../api/rule-groups/post";
-import {mapGetters} from "vuex";
-import {getCacheKey} from "../../store/fireflyiii/getters";
+// import {mapGetters} from "vuex";
- import {getCacheKey} from "../../store/fireflyiii/getters";
++// import {getCacheKey} from "../../store/fireflyiii/getters";
export default {
name: 'Create',
diff --cc frontend/src/pages/rule-groups/Edit.vue
index 222c44559f,222c44559f..b7dc6e564d
--- a/frontend/src/pages/rule-groups/Edit.vue
+++ b/frontend/src/pages/rule-groups/Edit.vue
@@@ -76,6 -76,6 +76,7 @@@
<script>
import Get from "../../api/rule-groups/get";
import Put from "../../api/rule-groups/put";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: "Edit",
@@@ -91,6 -91,6 +92,7 @@@
// rule group fields:
id: 0,
title: '',
++ store: null,
}
},
computed: {
@@@ -100,6 -100,6 +102,7 @@@
},
created() {
this.id = parseInt(this.$route.params.id);
++ this.store = useFireflyIIIStore();
this.collectRuleGroup();
},
methods: {
@@@ -143,7 -143,7 +146,7 @@@
this.errorMessage = '';
},
processSuccess: function (response) {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
if (!response) {
return;
}
diff --cc frontend/src/pages/rules/Create.vue
index c977c9b54c,2b2934a39d..3a4407363a
--- a/frontend/src/pages/rules/Create.vue
+++ b/frontend/src/pages/rules/Create.vue
@@@ -232,8 -232,8 +232,8 @@@
<script>
import Post from "../../api/rules/post";
-import {mapGetters} from "vuex";
-import {getCacheKey} from "../../store/fireflyiii/getters";
+// import {mapGetters} from "vuex";
- import {getCacheKey} from "../../store/fireflyiii/getters";
++// import {getCacheKey} from "../../store/fireflyiii/getters";
import Configuration from "../../api/system/configuration";
import List from "../../api/rule-groups/list";
diff --cc frontend/src/pages/rules/Edit.vue
index 2f2078f2a5,2f2078f2a5..df5fc8f046
--- a/frontend/src/pages/rules/Edit.vue
+++ b/frontend/src/pages/rules/Edit.vue
@@@ -76,6 -76,6 +76,7 @@@
<script>
import Get from "../../api/rules/get";
import Put from "../../api/rules/put";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: "Edit",
@@@ -91,6 -91,6 +92,7 @@@
// rule fields:
id: 0,
title: '',
++ store: null
}
},
computed: {
@@@ -100,6 -100,6 +102,7 @@@
},
created() {
this.id = parseInt(this.$route.params.id);
++ this.store = useFireflyIIIStore();
this.collectRule();
},
methods: {
@@@ -143,7 -143,7 +146,7 @@@
this.errorMessage = '';
},
processSuccess: function (response) {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
if (!response) {
return;
}
diff --cc frontend/src/pages/rules/Index.vue
index f4cf98b563,193e5834ab..c98402f1dd
--- a/frontend/src/pages/rules/Index.vue
+++ b/frontend/src/pages/rules/Index.vue
@@@ -101,6 -101,6 +101,7 @@@
import List from "../../api/rule-groups/list";
import Get from "../../api/rule-groups/get";
import Destroy from "../../api/generic/destroy";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: 'Index',
@@@ -113,6 -113,6 +114,7 @@@
}
},
mounted() {
++ this.store = useFireflyIIIStore();
this.triggerUpdate();
},
data() {
@@@ -126,6 -126,6 +128,7 @@@
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
ruleGroups: {},
++ store: null
}
},
computed: {
@@@ -162,13 -162,13 +165,13 @@@
},
destroyRuleGroup: function (id) {
(new Destroy('rule_groups')).destroy(id).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.triggerUpdate();
});
},
destroyRule: function (id) {
(new Destroy('rules')).destroy(id).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.triggerUpdate();
});
},
diff --cc frontend/src/pages/subscriptions/Index.vue
index f834dd9a77,07c603e6ad..afd5fbe3a4
--- a/frontend/src/pages/subscriptions/Index.vue
+++ b/frontend/src/pages/subscriptions/Index.vue
@@@ -85,9 -85,9 +85,10 @@@
</template>
<script>
-import {mapGetters, useStore} from "vuex";
+// import {mapGetters, useStore} from "vuex";
import List from "../../api/subscriptions/list";
import Destroy from "../../api/generic/destroy";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: 'Index',
@@@ -99,18 -99,18 +100,23 @@@
},
mounted() {
this.type = this.$route.params.type;
-- if (null === this.getRange.start || null === this.getRange.end) {
++ this.store = useFireflyIIIStore();
++ if (null === this.store.getRange.start || null === this.store.getRange.end) {
++
// subscribe, then update:
-- const $store = useStore();
-- $store.subscribe((mutation, state) => {
-- if ('fireflyiii/setRange' === mutation.type) {
-- this.range = {start: mutation.payload.start, end: mutation.payload.end};
-- this.triggerUpdate();
++ this.store.$onAction(
++ ({name, $store, args, after, onError,}) => {
++ after((result) => {
++ if (name === 'setRange') {
++ this.range = result;
++ this.triggerUpdate();
++ }
++ })
}
-- });
++ )
}
-- if (null !== this.getRange.start && null !== this.getRange.end) {
-- this.range = {start: this.getRange.start, end: this.getRange.end};
++ if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
++ this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate();
}
},
@@@ -129,6 -129,6 +135,7 @@@
{name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
++ store: null,
}
},
methods: {
@@@ -148,7 -148,7 +155,7 @@@
},
destroySubscription: function (id) {
(new Destroy('bills')).destroy(id).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.triggerUpdate();
});
},
diff --cc frontend/src/pages/tags/Index.vue
index e087427655,7db00d83b0..12befb3a23
--- a/frontend/src/pages/tags/Index.vue
+++ b/frontend/src/pages/tags/Index.vue
@@@ -76,18 -76,18 +76,21 @@@ export default
created() {
},
mounted() {
-- if (null === this.getRange.start || null === this.getRange.end) {
++ if (null === this.store.getRange.start || null === this.store.getRange.end) {
// subscribe, then update:
-- const $store = useStore();
-- $store.subscribe((mutation, state) => {
-- if ('fireflyiii/setRange' === mutation.type) {
-- this.range = {start: mutation.payload.start, end: mutation.payload.end};
-- this.triggerUpdate();
++ this.store.$onAction(
++ ({name, $store, args, after, onError,}) => {
++ after((result) => {
++ if (name === 'setRange') {
++ this.range = result;
++ this.triggerUpdate();
++ }
++ })
}
-- });
++ )
}
-- if (null !== this.getRange.start && null !== this.getRange.end) {
-- this.range = {start: this.getRange.start, end: this.getRange.end};
++ if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
++ this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate();
}
},
diff --cc frontend/src/pages/transactions/Edit.vue
index e376a084b5,e376a084b5..86643becd7
--- a/frontend/src/pages/transactions/Edit.vue
+++ b/frontend/src/pages/transactions/Edit.vue
@@@ -120,6 -120,6 +120,7 @@@ import formatISO from 'date-fns/formatI
import Put from "../../api/transactions/put";
import { useQuasar } from 'quasar';
import Get from "../../api/transactions/get";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: 'Edit',
@@@ -134,7 -134,7 +135,8 @@@
index: 0,
doResetForm: false,
group_title: '',
-- errorMessage: ''
++ errorMessage: '',
++ store: null
}
},
computed: {
@@@ -144,6 -144,6 +146,7 @@@
},
created() {
this.id = parseInt(this.$route.params.id);
++ this.store = useFireflyIIIStore();
this.resetForm();
this.collectTransaction();
},
@@@ -212,7 -212,7 +215,7 @@@
},
processSuccess: function (response) {
this.submitting = false;
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
let message = {
level: 'success',
text: 'Updated transaction',
diff --cc frontend/src/pages/transactions/Index.vue
index a06cb2abfb,ebfbb3489f..8fb68a74c9
--- a/frontend/src/pages/transactions/Index.vue
+++ b/frontend/src/pages/transactions/Index.vue
@@@ -120,18 -120,18 +120,24 @@@ export default
},
mounted() {
this.type = this.$route.params.type;
-- if (null === this.getRange.start || null === this.getRange.end) {
++ if (null === this.store.getRange.start || null === this.store.getRange.end) {
++
// subscribe, then update:
-- const $store = useStore();
-- $store.subscribe((mutation, state) => {
-- if ('fireflyiii/setRange' === mutation.type) {
-- this.range = {start: mutation.payload.start, end: mutation.payload.end};
-- this.triggerUpdate();
++ this.store.$onAction(
++ ({name, $store, args, after, onError,}) => {
++ after((result) => {
++ if (name === 'setRange') {
++ this.range = result;
++ this.triggerUpdate();
++ }
++ })
}
-- });
++ )
++
++
}
-- if (null !== this.getRange.start && null !== this.getRange.end) {
-- this.range = {start: this.getRange.start, end: this.getRange.end};
++ if (null !== this.store.getRange.start && null !== this.store.getRange.end) {
++ this.range = {start: this.store.getRange.start, end: this.store.getRange.end};
this.triggerUpdate();
}
},
diff --cc frontend/src/pages/webhooks/Create.vue
index da64bcedda,5831fb898d..cc7a166988
--- a/frontend/src/pages/webhooks/Create.vue
+++ b/frontend/src/pages/webhooks/Create.vue
@@@ -132,8 -132,8 +132,8 @@@
<script>
import Post from "../../api/webhooks/post";
-import {mapGetters} from "vuex";
-import {getCacheKey} from "../../store/fireflyiii/getters";
+// import {mapGetters} from "vuex";
- import {getCacheKey} from "../../store/fireflyiii/getters";
++// import {getCacheKey} from "../../store/fireflyiii/getters";
export default {
name: 'Create',
diff --cc frontend/src/pages/webhooks/Edit.vue
index 9675be9752,9675be9752..4871f3f1a2
--- a/frontend/src/pages/webhooks/Edit.vue
+++ b/frontend/src/pages/webhooks/Edit.vue
@@@ -130,6 -130,6 +130,7 @@@
<script>
import Get from "../../api/webhooks/get";
import Put from "../../api/webhooks/put";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: "Edit",
@@@ -165,6 -165,6 +166,7 @@@
response: '',
delivery: '',
trigger: '',
++ store: null,
}
},
computed: {
@@@ -174,6 -174,6 +176,7 @@@
},
created() {
this.id = parseInt(this.$route.params.id);
++ this.store = useFireflyIIIStore();
this.collectWebhook();
},
methods: {
@@@ -233,7 -233,7 +236,7 @@@
this.errorMessage = '';
},
processSuccess: function (response) {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
if (!response) {
return;
}
diff --cc frontend/src/pages/webhooks/Index.vue
index b93253c0fc,71c73802e4..431383da37
--- a/frontend/src/pages/webhooks/Index.vue
+++ b/frontend/src/pages/webhooks/Index.vue
@@@ -85,9 -85,9 +85,10 @@@
</template>
<script>
-import {mapGetters} from "vuex";
+// import {mapGetters} from "vuex";
import Destroy from "../../api/generic/destroy";
import List from "../../api/webhooks/list";
++import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: 'Index',
@@@ -116,6 -116,6 +117,7 @@@
{name: 'title', label: 'Title', field: 'title', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
++ store: null,
}
},
computed: {
@@@ -123,6 -123,6 +125,7 @@@
},
created() {
this.pagination.rowsPerPage = this.getListPageSize;
++ this.store = useFireflyIIIStore();
},
mounted() {
this.triggerUpdate();
@@@ -140,7 -140,7 +143,7 @@@
},
destroyWebhook: function (id) {
(new Destroy('webhooks')).destroy(id).then(() => {
-- this.$store.dispatch('fireflyiii/refreshCacheKey');
++ this.store.refreshCacheKey();
this.triggerUpdate();
});
},