Should fix message title.

This commit is contained in:
James Cole
2024-01-31 07:25:51 +01:00
parent b2449eb726
commit bafe2ece8c
2 changed files with 8 additions and 7 deletions

View File

@@ -395,7 +395,7 @@ export default {
getGroup() {
// console.log('EditTransaction: getGroup()');
const page = window.location.href.split('/');
const groupId = page[page.length - 1];
const groupId = parseInt(page[page.length - 1]);
const uri = './api/v1/transactions/' + groupId;
@@ -746,7 +746,7 @@ export default {
button.prop("disabled", true);
const page = window.location.href.split('/');
const groupId = page[page.length - 1];
const groupId = parseInt(page[page.length - 1]);
let uri = './api/v1/transactions/' + groupId + '?_token=' + document.head.querySelector('meta[name="csrf-token"]').content;
let method = 'PUT';
if (this.storeAsNew) {
@@ -763,7 +763,8 @@ export default {
data: data,
}).then(response => {
if (0 === this.collectAttachmentData(response)) {
this.redirectUser(response.data.data.id);
const title = response.data.data.attributes.group_title ?? response.data.data.attributes.transactions[0].description;
this.redirectUser(response.data.data.id, title);
}
}).catch(error => {
// give user errors things back.
@@ -777,15 +778,15 @@ export default {
button.removeAttr('disabled');
},
redirectUser(groupId) {
redirectUser(groupId, title) {
if (this.returnAfter) {
this.setDefaultErrors();
// do message if update or new:
if (this.storeAsNew) {
this.success_message = this.$t('firefly.transaction_new_stored_link', {ID: groupId});
this.success_message = this.$t('firefly.transaction_new_stored_link', {ID: groupId, title: title});
this.error_message = '';
} else {
this.success_message = this.$t('firefly.transaction_updated_link', {ID: groupId});
this.success_message = this.$t('firefly.transaction_updated_link', {ID: groupId, title: title});
this.error_message = '';
}
} else {

View File

@@ -277,7 +277,7 @@ export default {
getWebhook() {
this.loading = true;
const page = window.location.href.split('/');
this.id = page[page.length - 1]
this.id = parseInt(page[page.length - 1]);
this.downloadWebhook();
this.downloadWebhookMessages();
},