From 660ba90e5ff5bbe55750d89e140105196162b7c1 Mon Sep 17 00:00:00 2001 From: clauspeterhuebner Date: Mon, 5 May 2025 23:55:14 +0200 Subject: [PATCH] setTransactionLink with deepcopy to update recipientUser --- frontend/src/pages/TransactionLink.vue | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/frontend/src/pages/TransactionLink.vue b/frontend/src/pages/TransactionLink.vue index af70a1358..0f8d4aa68 100644 --- a/frontend/src/pages/TransactionLink.vue +++ b/frontend/src/pages/TransactionLink.vue @@ -274,12 +274,10 @@ onError(() => { function setTransactionLinkInformation() { console.log('TransactionLink.setTransactionLinkInformation... result=', result.value) - const queryTransactionLink = result.value.queryTransactionLink - console.log( - 'TransactionLink.setTransactionLinkInformation... queryTransactionLink=', - queryTransactionLink, - ) - if (queryTransactionLink && queryTransactionLink.__typename === 'TransactionLink') { + // const queryTransactionLink = result.value.queryTransactionLink + const deepCopy = JSON.parse(JSON.stringify(result.value)) + console.log('TransactionLink.setTransactionLinkInformation... deepCopy=', deepCopy) + if (deepCopy && deepCopy.queryTransactionLink.__typename === 'TransactionLink') { console.log('TransactionLink.setTransactionLinkInformation... typename === TransactionLink') // recipientUser is only set if the user is logged in if (store.state.gradidoID !== null) { @@ -287,18 +285,18 @@ function setTransactionLinkInformation() { 'TransactionLink.setTransactionLinkInformation... gradidoID=', store.state.gradidoID, ) - queryTransactionLink.recipientUser = { + deepCopy.queryTransactionLink.recipientUser = { __typename: 'User', gradidoID: store.state.gradidoID, firstName: store.state.firstName, alias: store.state.alias, } console.log( - 'TransactionLink.setTransactionLinkInformation... queryTransactionLink.recipientUser=', - queryTransactionLink.recipientUser, + 'TransactionLink.setTransactionLinkInformation... deepCopy.queryTransactionLink.recipientUser=', + deepCopy.queryTransactionLink.recipientUser, ) } - linkData.value = queryTransactionLink + linkData.value = deepCopy.queryTransactionLink console.log('TransactionLink.setTransactionLinkInformation... linkData.value=', linkData.value) if (linkData.value.__typename === 'ContributionLink' && store.state.token) { console.log('TransactionLink.setTransactionLinkInformation... typename === ContributionLink')