diff --git a/frontend/src/components/LinkInformations/RedeemInformation.vue b/frontend/src/components/LinkInformations/RedeemInformation.vue index 752cc9596..d287605a4 100644 --- a/frontend/src/components/LinkInformations/RedeemInformation.vue +++ b/frontend/src/components/LinkInformations/RedeemInformation.vue @@ -19,7 +19,7 @@ import CONFIG from '@/config' export default { name: 'RedeemInformation', props: { - user: { type: Object, required: true }, + user: { type: Object, required: false }, amount: { type: String, required: true }, memo: { type: String, required: true, default: '' }, isContributionLink: { type: Boolean, default: false }, diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 8f1c4e331..adcd653a4 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -114,36 +114,34 @@ export const queryOptIn = gql` export const queryTransactionLink = gql` query($code: String!) { queryTransactionLink(code: $code) { - LinkType { - ... on TransactionLink { - id - amount - memo - createdAt - validUntil - redeemedAt - deletedAt - user { - firstName - publisherId - email - } - } - ... on ContributionLink { - id - validTo - validFrom - amount - name - memo - cycle - createdAt - code - link - deletedAt - maxAmountPerMonth + ... on TransactionLink { + id + amount + memo + createdAt + validUntil + redeemedAt + deletedAt + user { + firstName + publisherId + email } } + ... on ContributionLink { + id + validTo + validFrom + amount + name + memo + cycle + createdAt + code + link + deletedAt + maxAmountPerMonth + } } } ` diff --git a/frontend/src/pages/TransactionLink.vue b/frontend/src/pages/TransactionLink.vue index a62453c64..749708901 100644 --- a/frontend/src/pages/TransactionLink.vue +++ b/frontend/src/pages/TransactionLink.vue @@ -56,6 +56,7 @@ export default { setTransactionLinkInformation() { this.$apollo .query({ + fetchPolicy: 'no-cache', query: queryTransactionLink, variables: { code: this.$route.params.code, @@ -99,48 +100,49 @@ export default { return this.$route.params.code.search(/^CL-/) === 0 }, itemType() { - // link wurde gelöscht: am, von - if (this.linkData.deletedAt) { - // eslint-disable-next-line vue/no-side-effects-in-computed-properties - this.redeemedBoxText = this.$t('gdd_per_link.link-deleted', { + /* + // link wurde gelöscht: am, von + if (this.linkData.deletedAt) { + // eslint-disable-next-line vue/no-side-effects-in-computed-properties + this.redeemedBoxText = this.$t('gdd_per_link.link-deleted', { date: this.$d(new Date(this.linkData.deletedAt), 'long'), - }) - return `TEXT` - } - // link ist abgelaufen, nicht gelöscht - if (new Date(this.linkData.validUntil) < new Date()) { - // eslint-disable-next-line vue/no-side-effects-in-computed-properties - this.redeemedBoxText = this.$t('gdd_per_link.link-expired', { + }) + return `TEXT` + } + // link ist abgelaufen, nicht gelöscht + if (new Date(this.linkData.validUntil) < new Date()) { + // eslint-disable-next-line vue/no-side-effects-in-computed-properties + this.redeemedBoxText = this.$t('gdd_per_link.link-expired', { date: this.$d(new Date(this.linkData.validUntil), 'long'), - }) - return `TEXT` - } + }) + return `TEXT` + } - // der link wurde eingelöst, nicht gelöscht - if (this.linkData.redeemedAt) { - // eslint-disable-next-line vue/no-side-effects-in-computed-properties - this.redeemedBoxText = this.$t('gdd_per_link.redeemed-at', { + // der link wurde eingelöst, nicht gelöscht + if (this.linkData.redeemedAt) { + // eslint-disable-next-line vue/no-side-effects-in-computed-properties + this.redeemedBoxText = this.$t('gdd_per_link.redeemed-at', { date: this.$d(new Date(this.linkData.redeemedAt), 'long'), - }) - return `TEXT` - } + }) + return `TEXT` + } - if (this.$store.state.token) { - // logged in, nicht berechtigt einzulösen, eigener link - if (this.$store.state.email === this.linkData.user.email) { + if (this.$store.state.token) { + // logged in, nicht berechtigt einzulösen, eigener link + if (this.$store.state.email === this.linkData.user.email) { return `SELF_CREATOR` - } + } - // logged in und berechtigt einzulösen - if ( + // logged in und berechtigt einzulösen + if ( this.$store.state.email !== this.linkData.user.email && !this.linkData.redeemedAt && !this.linkData.deletedAt - ) { + ) { return `VALID` - } - } - + } + } + */ return `LOGGED_OUT` }, }, diff --git a/frontend/src/plugins/apolloProvider.js b/frontend/src/plugins/apolloProvider.js index adf9f180a..4a0ff9914 100644 --- a/frontend/src/plugins/apolloProvider.js +++ b/frontend/src/plugins/apolloProvider.js @@ -31,7 +31,7 @@ const apolloClient = new ApolloClient({ link: authLink.concat(httpLink), cache: new InMemoryCache({ possibleTypes: { - LinkType: ['TransactionLink', 'ContributionLink'], + QueryLinkResult: ['TransactionLink', 'ContributionLink'], }, }), })