Add link to the TransactionLink and change code by link in frontend.

This commit is contained in:
elweyn 2022-04-06 18:45:27 +02:00
parent d984ff2582
commit 41b35f2c5e
7 changed files with 16 additions and 7 deletions

View File

@ -12,12 +12,13 @@ export class TransactionLink {
this.amount = transactionLink.amount
this.holdAvailableAmount = transactionLink.holdAvailableAmount
this.memo = transactionLink.memo
this.code = CONFIG.COMMUNITY_URL + 'redeem/' + transactionLink.code
this.code = transactionLink.code
this.createdAt = transactionLink.createdAt
this.validUntil = transactionLink.validUntil
this.deletedAt = transactionLink.deletedAt
this.redeemedAt = transactionLink.redeemedAt
this.redeemedBy = redeemedBy
this.link = CONFIG.COMMUNITY_REDEEM_URL + this.code
}
@Field(() => Number)
@ -52,6 +53,9 @@ export class TransactionLink {
@Field(() => User, { nullable: true })
redeemedBy: User | null
@Field(() => String)
link: string
}
@ObjectType()

View File

@ -14,11 +14,11 @@
export default {
name: 'ClipboardCopy',
props: {
code: { type: String, required: true },
link: { type: String, required: true },
},
data() {
return {
url: `${this.code}`,
url: `${this.link}`,
}
},
methods: {

View File

@ -5,7 +5,7 @@
<b-card class="p-0 gradido-custom-background">
<div class="p-4">
<div class="h3 mb-5">{{ $t('gdd_per_link.created') }}</div>
<clipboard-copy :code="code" />
<clipboard-copy :link="link" />
</div>
<p class="text-center mt-3">
<b-button variant="success" @click="$emit('on-reset')">{{ $t('form.close') }}</b-button>
@ -24,7 +24,7 @@ export default {
ClipboardCopy,
},
props: {
code: {
link: {
type: String,
required: true,
},

View File

@ -55,6 +55,7 @@ export default {
props: {
amount: { type: String, required: true },
code: { type: String, required: true },
link: { type: String, required: true },
holdAvailableAmount: { type: String, required: true },
id: { type: Number, required: true },
memo: { type: String, required: true },
@ -62,7 +63,7 @@ export default {
},
methods: {
copy() {
const link = `${window.location.origin}/redeem/${this.code}`
const link = `${this.link}`
navigator.clipboard
.writeText(link)
.then(() => {

View File

@ -76,6 +76,7 @@ export const createTransactionLink = gql`
mutation($amount: Decimal!, $memo: String!) {
createTransactionLink(amount: $amount, memo: $memo) {
code
link
}
}
`

View File

@ -155,6 +155,7 @@ export const listTransactionLinks = gql`
holdAvailableAmount
memo
code
link
createdAt
validUntil
redeemedAt

View File

@ -41,7 +41,7 @@
></transaction-result-send-error>
</template>
<template #transactionResultLink>
<transaction-result-link :code="code" @on-reset="onReset"></transaction-result-link>
<transaction-result-link :link="link" @on-reset="onReset"></transaction-result-link>
</template>
</gdd-send>
<hr />
@ -88,6 +88,7 @@ export default {
currentTransactionStep: TRANSACTION_STEPS.transactionForm,
loading: false,
code: null,
link: null,
}
},
props: {
@ -145,6 +146,7 @@ export default {
.then((result) => {
this.$emit('set-tunneled-email', null)
this.code = result.data.createTransactionLink.code
this.link = result.data.createTransactionLink.link
this.transactionData = { ...EMPTY_TRANSACTION_DATA }
this.currentTransactionStep = TRANSACTION_STEPS.transactionResultLink
this.updateTransactions({})