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

View File

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