Fix store references

This commit is contained in:
James Cole
2022-05-08 09:32:07 +02:00
31 changed files with 225 additions and 121 deletions

View File

@@ -108,7 +108,11 @@ class FixTransactionTypes extends Command
}
$expectedType = (string) config(sprintf('firefly.account_to_transaction.%s.%s', $source->accountType->type, $destination->accountType->type));
if ($expectedType !== $type) {
$this->line(sprintf('Transaction journal #%d was of type "%s" but is corrected to "%s"', $journal->id, $type, $expectedType));
$this->line(
sprintf('Transaction journal #%d was of type "%s" but is corrected to "%s" (%s -> %s)',
$journal->id, $type, $expectedType,
$source->accountType->type, $destination->accountType->type,
));
$this->changeJournal($journal, $expectedType);
return true;

View File

@@ -608,7 +608,10 @@ 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 => TransactionTypeEnum::DEPOSIT->value,
@@ -693,6 +696,7 @@ return [
AccountType::LOAN => [AccountType::LIABILITY_CREDIT],
AccountType::DEBT => [AccountType::LIABILITY_CREDIT],
AccountType::MORTGAGE => [AccountType::LIABILITY_CREDIT],
AccountType::LIABILITY_CREDIT => [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE],
],
],
// if you add fields to this array, dont forget to update the export routine (ExportDataGenerator).

View File

@@ -159,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.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();
}
},

View File

@@ -168,7 +168,7 @@ export default {
},
destroyBudget: function (id) {
(new Destroy('budgets')).destroy(id).then(() => {
this.store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
this.triggerUpdate();
});
},

View File

@@ -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 +92,7 @@ export default {
// category fields:
id: 0,
name: '',
store: null
}
},
computed: {
@@ -101,6 +103,7 @@ export default {
created() {
this.id = parseInt(this.$route.params.id);
this.collectCategory();
this.store = useFireflyIIIStore();
},
methods: {
collectCategory: function() {
@@ -144,7 +147,7 @@ export default {
this.errorMessage = '';
},
processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
if (!response) {
return;
}

View File

@@ -90,6 +90,7 @@
// 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 +119,7 @@ export default {
{name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
store: null,
}
},
computed: {
@@ -125,21 +127,27 @@ export default {
},
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.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 +164,7 @@ export default {
},
destroyCategory: function (id) {
(new Destroy('categories')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
this.triggerUpdate();
});
},

View File

@@ -97,6 +97,7 @@
<script>
import Post from "../../api/currencies/post";
import {useFireflyIIIStore} from "../../stores/fireflyiii";
export default {
name: 'Create',
@@ -113,6 +114,7 @@ export default {
name: '',
code: '',
symbol: '',
store: null,
}
},
computed: {
@@ -123,6 +125,7 @@ export default {
created() {
this.resetForm();
this.type = this.$route.params.type;
this.store = useFireflyIIIStore();
},
methods: {
resetForm: function () {
@@ -175,7 +178,7 @@ export default {
if (!response) {
return;
}
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
this.submitting = false;
let message = {
level: 'success',

View File

@@ -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 +113,7 @@ export default {
code: '',
name: '',
symbol: '',
store: null,
}
},
computed: {
@@ -122,6 +124,7 @@ export default {
created() {
this.code = this.$route.params.code;
this.collectCurrency();
this.store = useFireflyIIIStore();
},
methods: {
collectCurrency: function() {
@@ -172,7 +175,7 @@ export default {
this.errorMessage = '';
},
processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
if (!response) {
return;
}

View File

@@ -90,6 +90,7 @@
// 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 +120,7 @@ export default {
{name: 'name', label: 'Code', field: 'code', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
store: null,
}
},
computed: {
@@ -126,21 +128,27 @@ export default {
},
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.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 +166,7 @@ export default {
},
destroyCurrency: function (code) {
(new Destroy('currencies')).destroy(code).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
this.triggerUpdate();
});
},

View File

@@ -128,8 +128,8 @@ export default {
this.store = useFireflyIIIStore();
if (null === this.range.start || null === this.range.end) {
// subscribe, then update:
// subscribe, then update:
this.store.$onAction(
({name, $store, args, after, onError,}) => {
after((result) => {

View File

@@ -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 +92,7 @@ export default {
// group fields:
id: 0,
title: '',
store: null,
}
},
computed: {
@@ -101,6 +103,7 @@ export default {
created() {
this.id = parseInt(this.$route.params.id);
this.collectGroup();
this.store = useFireflyIIIStore();
},
methods: {
collectGroup: function() {
@@ -144,7 +147,7 @@ export default {
this.errorMessage = '';
},
processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
if (!response) {
return;
}

View File

@@ -74,6 +74,7 @@
// 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 +102,8 @@ export default {
columns: [
{name: 'title', label: 'Title', field: 'title', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
]
],
store: null
}
},
computed: {
@@ -109,21 +111,26 @@ export default {
},
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.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 +148,7 @@ export default {
},
destroyGroup: function (identifier) {
(new Destroy('object_groups')).destroy(identifier).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
this.triggerUpdate();
});
},

View File

@@ -105,7 +105,7 @@
import Post from "../../api/piggy-banks/post";
import List from "../../api/accounts/list";
// import {mapGetters} from "vuex";
import {getCacheKey} from "../../store/fireflyiii/getters";
// import {getCacheKey} from "../../store/fireflyiii/getters";
export default {
name: 'Create',

View File

@@ -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 +92,7 @@ export default {
// piggy bank fields:
id: 0,
name: '',
store: null,
}
},
computed: {
@@ -101,6 +103,7 @@ export default {
created() {
this.id = parseInt(this.$route.params.id);
this.collectPiggyBank();
this.store = useFireflyIIIStore();
},
methods: {
collectPiggyBank: function() {
@@ -143,7 +146,7 @@ export default {
this.errorMessage = '';
},
processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
if (!response) {
return;
}

View File

@@ -87,6 +87,7 @@
// 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 +116,7 @@ export default {
{name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
store: null,
}
},
computed: {
@@ -122,20 +124,24 @@ export default {
},
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.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 +158,7 @@ export default {
},
destroyPiggyBank: function (id) {
(new Destroy('piggy_banks')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
this.triggerUpdate();
});
},

View File

@@ -147,11 +147,13 @@ import Configuration from "../../api/system/configuration";
import Put from "../../api/preferences/put";
import Preferences from "../../api/preferences";
import List from "../../api/accounts/list";
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 +227,8 @@ export default {
date: [],
meta: [],
ref: []
}
},
store: null,
}
},
watch: {
@@ -233,7 +236,7 @@ export default {
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 +259,7 @@ export default {
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 +271,7 @@ export default {
},
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 +283,7 @@ export default {
},
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 +331,7 @@ export default {
}
}
(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;

View File

@@ -224,7 +224,7 @@
<script>
import Post from "../../api/recurring/post";
// 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";

View File

@@ -228,6 +228,7 @@ import Put from "../../api/recurring/put";
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 +268,8 @@ export default {
nr_of_repetitions: 0,
repeat_until: '',
repetitions: {},
transactions: {}
transactions: {},
store: null,
}
},
watch: {
@@ -284,6 +286,7 @@ export default {
// 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 +523,7 @@ export default {
this.errorMessage = '';
},
processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
if (!response) {
return;
}

View File

@@ -87,6 +87,7 @@
// 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 +116,7 @@ export default {
{name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
store: null
}
},
computed: {
@@ -122,21 +124,25 @@ export default {
},
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.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 +159,7 @@ export default {
},
destroyRecurring: function (id) {
(new Destroy('recurrences')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
this.triggerUpdate();
});
},

View File

@@ -76,7 +76,7 @@
<script>
import Post from "../../api/rule-groups/post";
// import {mapGetters} from "vuex";
import {getCacheKey} from "../../store/fireflyiii/getters";
// import {getCacheKey} from "../../store/fireflyiii/getters";
export default {
name: 'Create',

View File

@@ -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 +92,7 @@ export default {
// rule group fields:
id: 0,
title: '',
store: null,
}
},
computed: {
@@ -100,6 +102,7 @@ export default {
},
created() {
this.id = parseInt(this.$route.params.id);
this.store = useFireflyIIIStore();
this.collectRuleGroup();
},
methods: {
@@ -143,7 +146,7 @@ export default {
this.errorMessage = '';
},
processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
if (!response) {
return;
}

View File

@@ -233,7 +233,7 @@
<script>
import Post from "../../api/rules/post";
// 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";

View File

@@ -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 +92,7 @@ export default {
// rule fields:
id: 0,
title: '',
store: null
}
},
computed: {
@@ -100,6 +102,7 @@ export default {
},
created() {
this.id = parseInt(this.$route.params.id);
this.store = useFireflyIIIStore();
this.collectRule();
},
methods: {
@@ -143,7 +146,7 @@ export default {
this.errorMessage = '';
},
processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
if (!response) {
return;
}

View File

@@ -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 +114,7 @@ export default {
}
},
mounted() {
this.store = useFireflyIIIStore();
this.triggerUpdate();
},
data() {
@@ -126,6 +128,7 @@ export default {
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
ruleGroups: {},
store: null
}
},
computed: {
@@ -162,13 +165,13 @@ export default {
},
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();
});
},

View File

@@ -88,6 +88,7 @@
// 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 +100,23 @@ export default {
},
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.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 +135,7 @@ export default {
{name: 'name', label: 'Name', field: 'name', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
store: null,
}
},
methods: {
@@ -148,7 +155,7 @@ export default {
},
destroySubscription: function (id) {
(new Destroy('bills')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
this.triggerUpdate();
});
},

View File

@@ -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.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();
}
},

View File

@@ -120,6 +120,7 @@ import formatISO from 'date-fns/formatISO';
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 +135,8 @@ export default {
index: 0,
doResetForm: false,
group_title: '',
errorMessage: ''
errorMessage: '',
store: null
}
},
computed: {
@@ -144,6 +146,7 @@ export default {
},
created() {
this.id = parseInt(this.$route.params.id);
this.store = useFireflyIIIStore();
this.resetForm();
this.collectTransaction();
},
@@ -212,7 +215,7 @@ export default {
},
processSuccess: function (response) {
this.submitting = false;
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
let message = {
level: 'success',
text: 'Updated transaction',

View File

@@ -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.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();
}
},

View File

@@ -133,7 +133,7 @@
<script>
import Post from "../../api/webhooks/post";
// import {mapGetters} from "vuex";
import {getCacheKey} from "../../store/fireflyiii/getters";
// import {getCacheKey} from "../../store/fireflyiii/getters";
export default {
name: 'Create',

View File

@@ -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 +166,7 @@ export default {
response: '',
delivery: '',
trigger: '',
store: null,
}
},
computed: {
@@ -174,6 +176,7 @@ export default {
},
created() {
this.id = parseInt(this.$route.params.id);
this.store = useFireflyIIIStore();
this.collectWebhook();
},
methods: {
@@ -233,7 +236,7 @@ export default {
this.errorMessage = '';
},
processSuccess: function (response) {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
if (!response) {
return;
}

View File

@@ -88,6 +88,7 @@
// 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 +117,7 @@ export default {
{name: 'title', label: 'Title', field: 'title', align: 'left'},
{name: 'menu', label: ' ', field: 'menu', align: 'right'},
],
store: null,
}
},
computed: {
@@ -123,6 +125,7 @@ export default {
},
created() {
this.pagination.rowsPerPage = this.getListPageSize;
this.store = useFireflyIIIStore();
},
mounted() {
this.triggerUpdate();
@@ -140,7 +143,7 @@ export default {
},
destroyWebhook: function (id) {
(new Destroy('webhooks')).destroy(id).then(() => {
this.$store.dispatch('fireflyiii/refreshCacheKey');
this.store.refreshCacheKey();
this.triggerUpdate();
});
},