error message for incorrect redemption link

This commit is contained in:
ogerly 2023-04-27 10:06:54 +02:00
parent a4351ba881
commit 00a6d15b51
5 changed files with 21 additions and 8 deletions

View File

@ -1,11 +1,12 @@
<template> <template>
<div class="redeem-information"> <div class="redeem-information">
<b-jumbotron bg-variant="muted" text-variant="dark" border-variant="info"> <b-jumbotron bg-variant="muted" text-variant="dark" border-variant="info">
<h1 v-if="isContributionLink"> <h1 v-if="amount === ''">{{ $t('gdd_per_link.redeemlink-error') }}</h1>
<h1 v-if="isContributionLink && amount !== ''">
{{ CONFIG.COMMUNITY_NAME }} {{ CONFIG.COMMUNITY_NAME }}
{{ $t('contribution-link.thanksYouWith') }} {{ amount | GDD }} {{ $t('contribution-link.thanksYouWith') }} {{ amount | GDD }}
</h1> </h1>
<h1 v-else> <h1 v-if="!isContributionLink && amount !== ''">
{{ user.firstName }} {{ user.firstName }}
{{ $t('transaction-link.send_you') }} {{ amount | GDD }} {{ $t('transaction-link.send_you') }} {{ amount | GDD }}
</h1> </h1>

View File

@ -3,7 +3,12 @@
<redeem-information v-bind="linkData" :isContributionLink="isContributionLink" /> <redeem-information v-bind="linkData" :isContributionLink="isContributionLink" />
<b-jumbotron> <b-jumbotron>
<div class="mb-3 text-center"> <div class="mb-3 text-center">
<b-button variant="gradido" @click="$emit('mutation-link', linkData.amount)" size="lg"> <b-button
variant="gradido"
@click="$emit('mutation-link', linkData.amount)"
size="lg"
:disabled="!validLink"
>
{{ $t('gdd_per_link.redeem') }} {{ $t('gdd_per_link.redeem') }}
</b-button> </b-button>
</div> </div>
@ -21,6 +26,7 @@ export default {
props: { props: {
linkData: { type: Object, required: true }, linkData: { type: Object, required: true },
isContributionLink: { type: Boolean, default: false }, isContributionLink: { type: Boolean, default: false },
validLink: { type: Boolean, default: false },
}, },
} }
</script> </script>

View File

@ -204,6 +204,7 @@
"redeemed": "Erfolgreich eingelöst! Deinem Konto wurden {n} GDD gutgeschrieben.", "redeemed": "Erfolgreich eingelöst! Deinem Konto wurden {n} GDD gutgeschrieben.",
"redeemed-at": "Der Link wurde bereits am {date} eingelöst.", "redeemed-at": "Der Link wurde bereits am {date} eingelöst.",
"redeemed-title": "eingelöst", "redeemed-title": "eingelöst",
"redeemlink-error":"Dieser Einlöse-Link ist nicht vollständig.",
"to-login": "Log dich ein", "to-login": "Log dich ein",
"to-register": "Registriere ein neues Konto.", "to-register": "Registriere ein neues Konto.",
"validUntil": "Gültig bis", "validUntil": "Gültig bis",

View File

@ -204,6 +204,7 @@
"redeemed": "Successfully redeemed! Your account has been credited with {n} GDD.", "redeemed": "Successfully redeemed! Your account has been credited with {n} GDD.",
"redeemed-at": "The link was already redeemed on {date}.", "redeemed-at": "The link was already redeemed on {date}.",
"redeemed-title": "redeemed", "redeemed-title": "redeemed",
"redeemlink-error":"This redemption link is not complete.",
"to-login": "Log in", "to-login": "Log in",
"to-register": "Register a new account.", "to-register": "Register a new account.",
"validUntil": "Valid until", "validUntil": "Valid until",

View File

@ -14,6 +14,7 @@
<redeem-valid <redeem-valid
:linkData="linkData" :linkData="linkData"
:isContributionLink="isContributionLink" :isContributionLink="isContributionLink"
:validLink="validLink"
@mutation-link="mutationLink" @mutation-link="mutationLink"
/> />
</template> </template>
@ -47,12 +48,13 @@ export default {
return { return {
linkData: { linkData: {
__typename: 'TransactionLink', __typename: 'TransactionLink',
amount: '123.45', amount: '',
memo: 'memo', memo: '',
user: { user: {
firstName: 'Bibi', firstName: '',
}, },
deletedAt: null, deletedAt: null,
validLink: false,
}, },
} }
}, },
@ -67,13 +69,15 @@ export default {
}, },
}) })
.then((result) => { .then((result) => {
this.validLink = true
this.linkData = result.data.queryTransactionLink this.linkData = result.data.queryTransactionLink
if (this.linkData.__typename === 'ContributionLink' && this.$store.state.token) { if (this.linkData.__typename === 'ContributionLink' && this.$store.state.token) {
this.mutationLink(this.linkData.amount) this.mutationLink(this.linkData.amount)
} }
}) })
.catch((err) => { .catch(() => {
this.toastError(err.message) this.toastError(this.$t('gdd_per_link.redeemlink-error'))
// this.$router.push('/overview')
}) })
}, },
mutationLink(amount) { mutationLink(amount) {