mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
adapt first part of redeem UI requirements
This commit is contained in:
parent
343a9a158a
commit
0c10a31178
@ -6,15 +6,33 @@
|
||||
:is-redeem-jwt-link="isRedeemJwtLink"
|
||||
class="redeem-community-selection"
|
||||
>
|
||||
<BCard bg-variant="muted" text-variant="dark" border-variant="info">
|
||||
<BRow bg-variant="muted" text-variant="dark">
|
||||
<h1 v-if="linkData.amount === ''">{{ $t('gdd_per_link.redeemlink-error') }}</h1>
|
||||
<h1 v-if="!isContributionLink && linkData.amount !== ''">
|
||||
<template v-if="linkData.senderUser">
|
||||
{{ linkData.senderUser.firstName }}
|
||||
{{ $t('transaction-link.send_you') }} {{ linkData.amount }} {{ $t('GDD-long') }}
|
||||
</template>
|
||||
</h1>
|
||||
<BRow>
|
||||
<BCol class="mb-4" cols="12">
|
||||
<b>{{ linkData.memo }}</b>
|
||||
</BCol>
|
||||
</BRow>
|
||||
<BRow v-if="!isContributionLink && linkData.amount !== ''">
|
||||
<BCol class="mb-4" cols="12">
|
||||
<BRow>
|
||||
<BCol v-if="!isRedeemJwtLink">
|
||||
{{ $t('gdd_per_link.recipientCommunitySelection') }}
|
||||
<BCol v-if="!isRedeemJwtLink" class="fw-bold">
|
||||
<div v-if="isForeignCommunitySelected">
|
||||
{{ $t('gdd_per_link.recipientCommunityRedirection') }}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ $t('gdd_per_link.recipientCommunitySelection') }}
|
||||
</div>
|
||||
</BCol>
|
||||
<BCol v-else class="fw-bold">
|
||||
{{ $t('gdd_per_link.recipientCommunityFix') }}
|
||||
</BCol>
|
||||
<BCol v-else>{{ $t('gdd_per_link.recipientCommunityFix') }}</BCol>
|
||||
</BRow>
|
||||
<h3>
|
||||
<BRow>
|
||||
@ -29,7 +47,6 @@
|
||||
{{ currentRecipientCommunity.name }}
|
||||
</BCol>
|
||||
<BCol v-if="isForeignCommunitySelected" sm="12" md="6" class="mt-4 mt-lg-0">
|
||||
<p>{{ $t('gdd_per_link.switchCommunity') }}</p>
|
||||
<BButton variant="gradido" @click="onSwitch">
|
||||
{{ $t('gdd_per_link.to-switch') }}
|
||||
</BButton>
|
||||
@ -37,13 +54,8 @@
|
||||
</BRow>
|
||||
</h3>
|
||||
</BCol>
|
||||
<template v-if="linkData.senderUser">
|
||||
{{ linkData.senderUser.firstName }}
|
||||
{{ $t('transaction-link.send_you') }} {{ $filters.GDD(linkData.amount) }}
|
||||
</template>
|
||||
</h1>
|
||||
<b>{{ linkData.memo }}</b>
|
||||
</BCard>
|
||||
</BRow>
|
||||
</BRow>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
@ -77,15 +89,15 @@ const currentRecipientCommunity = computed(
|
||||
const emit = defineEmits(['update:recipientCommunity'])
|
||||
|
||||
const isForeignCommunitySelected = computed(() => {
|
||||
// console.log(
|
||||
// 'RedeemCommunitySelection.isForeignCommunitySelected...recipientCommunity=',
|
||||
// currentRecipientCommunity.value,
|
||||
// )
|
||||
console.log(
|
||||
'RedeemCommunitySelection.isForeignCommunitySelected...recipientCommunity=',
|
||||
currentRecipientCommunity.value,
|
||||
)
|
||||
return currentRecipientCommunity.value.foreign
|
||||
})
|
||||
|
||||
function setRecipientCommunity(community) {
|
||||
// console.log('RedeemCommunitySelection.setRecipientCommunity...community=', community)
|
||||
console.log('RedeemCommunitySelection.setRecipientCommunity...community=', community)
|
||||
emit('update:recipientCommunity', {
|
||||
uuid: community.uuid,
|
||||
name: community.name,
|
||||
@ -95,19 +107,19 @@ function setRecipientCommunity(community) {
|
||||
}
|
||||
|
||||
function extractHomeCommunityFromLinkData(linkData) {
|
||||
// console.log(
|
||||
// 'RedeemCommunitySelection.extractHomeCommunityFromLinkData... props.linkData=',
|
||||
// props.linkData,
|
||||
// )
|
||||
// console.log('RedeemCommunitySelection.extractHomeCommunityFromLinkData...linkData=', linkData)
|
||||
// console.log(
|
||||
// 'RedeemCommunitySelection.extractHomeCommunityFromLinkData...communities=',
|
||||
// linkData.communities,
|
||||
// )
|
||||
// console.log(
|
||||
// 'RedeemCommunitySelection.extractHomeCommunityFromLinkData...linkData.value=',
|
||||
// linkData.value,
|
||||
// )
|
||||
console.log(
|
||||
'RedeemCommunitySelection.extractHomeCommunityFromLinkData... props.linkData=',
|
||||
props.linkData,
|
||||
)
|
||||
console.log('RedeemCommunitySelection.extractHomeCommunityFromLinkData...linkData=', linkData)
|
||||
console.log(
|
||||
'RedeemCommunitySelection.extractHomeCommunityFromLinkData...communities=',
|
||||
linkData.communities,
|
||||
)
|
||||
console.log(
|
||||
'RedeemCommunitySelection.extractHomeCommunityFromLinkData...linkData.value=',
|
||||
linkData.value,
|
||||
)
|
||||
|
||||
if (linkData.communities?.length === 0) {
|
||||
return {
|
||||
@ -118,15 +130,15 @@ function extractHomeCommunityFromLinkData(linkData) {
|
||||
}
|
||||
}
|
||||
const communities = linkData.communities
|
||||
// console.log(
|
||||
// 'RedeemCommunitySelection.extractHomeCommunityFromLinkData...communities=',
|
||||
// communities,
|
||||
// )
|
||||
console.log(
|
||||
'RedeemCommunitySelection.extractHomeCommunityFromLinkData...communities=',
|
||||
communities,
|
||||
)
|
||||
const homeCommunity = communities?.find((c) => c.foreign === false)
|
||||
// console.log(
|
||||
// 'RedeemCommunitySelection.extractHomeCommunityFromLinkData...homeCommunity=',
|
||||
// homeCommunity,
|
||||
// )
|
||||
console.log(
|
||||
'RedeemCommunitySelection.extractHomeCommunityFromLinkData...homeCommunity=',
|
||||
homeCommunity,
|
||||
)
|
||||
return {
|
||||
uuid: homeCommunity.uuid,
|
||||
name: homeCommunity.name,
|
||||
@ -139,20 +151,20 @@ const { mutate: createRedeemJwt } = useMutation(createRedeemJwtMutation)
|
||||
|
||||
async function onSwitch(event) {
|
||||
event.preventDefault() // Prevent the default navigation
|
||||
// console.log('RedeemCommunitySelection.onSwitch... props=', props)
|
||||
console.log('RedeemCommunitySelection.onSwitch... props=', props)
|
||||
if (isForeignCommunitySelected.value) {
|
||||
// console.log('RedeemCommunitySelection.onSwitch vor createRedeemJwt params:', {
|
||||
// gradidoId: props.linkData.senderUser?.gradidoID,
|
||||
// senderCommunityUuid: senderCommunity.value.uuid,
|
||||
// senderCommunityName: senderCommunity.value.name,
|
||||
// recipientCommunityUuid: currentRecipientCommunity.value.uuid,
|
||||
// code: props.redeemCode,
|
||||
// amount: props.linkData.amount,
|
||||
// memo: props.linkData.memo,
|
||||
// firstName: props.linkData.senderUser?.firstName,
|
||||
// alias: props.linkData.senderUser?.alias,
|
||||
// validUntil: props.linkData.validUntil,
|
||||
// })
|
||||
console.log('RedeemCommunitySelection.onSwitch vor createRedeemJwt params:', {
|
||||
gradidoId: props.linkData.senderUser?.gradidoID,
|
||||
senderCommunityUuid: senderCommunity.value.uuid,
|
||||
senderCommunityName: senderCommunity.value.name,
|
||||
recipientCommunityUuid: currentRecipientCommunity.value.uuid,
|
||||
code: props.redeemCode,
|
||||
amount: props.linkData.amount,
|
||||
memo: props.linkData.memo,
|
||||
firstName: props.linkData.senderUser?.firstName,
|
||||
alias: props.linkData.senderUser?.alias,
|
||||
validUntil: props.linkData.validUntil,
|
||||
})
|
||||
// eslint-disable-next-line no-useless-catch
|
||||
try {
|
||||
const { data } = await createRedeemJwt({
|
||||
@ -167,14 +179,14 @@ async function onSwitch(event) {
|
||||
alias: props.linkData.senderUser?.alias,
|
||||
validUntil: props.linkData.validUntil,
|
||||
})
|
||||
// console.log('RedeemCommunitySelection.onSwitch... response=', data)
|
||||
console.log('RedeemCommunitySelection.onSwitch... response=', data)
|
||||
if (!data?.createRedeemJwt) {
|
||||
throw new Error('Failed to get redeem token')
|
||||
}
|
||||
const targetUrl = currentRecipientCommunity.value.url.replace(/\/api\/?$/, '')
|
||||
window.location.href = targetUrl + '/redeem/' + data.createRedeemJwt
|
||||
} catch (error) {
|
||||
// console.error('RedeemCommunitySelection.onSwitch error:', error)
|
||||
console.error('RedeemCommunitySelection.onSwitch error:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,41 +1,31 @@
|
||||
<template>
|
||||
<div class="redeem-select-community">
|
||||
<redeem-community-selection
|
||||
v-model:recipient-community="recipientCommunity"
|
||||
:link-data="props.linkData"
|
||||
:redeem-code="props.redeemCode"
|
||||
:is-transaction-link-loaded="props.isTransactionLinkLoaded"
|
||||
:is-contribution-link="props.isContributionLink"
|
||||
:is-redeem-jwt-link="props.isRedeemJwtLink"
|
||||
/>
|
||||
|
||||
<BCard v-if="props.isTransactionLinkLoaded">
|
||||
<div class="mb-2">
|
||||
<h2>{{ $t('gdd_per_link.redeem') }}</h2>
|
||||
<redeem-community-selection
|
||||
v-model:recipient-community="recipientCommunity"
|
||||
:link-data="props.linkData"
|
||||
:redeem-code="props.redeemCode"
|
||||
:is-transaction-link-loaded="props.isTransactionLinkLoaded"
|
||||
:is-contribution-link="props.isContributionLink"
|
||||
:is-redeem-jwt-link="props.isRedeemJwtLink"
|
||||
/>
|
||||
<div v-if="!isForeignCommunitySelected">
|
||||
<h2>{{ $t('gdd_per_link.redeem-community') }} {{ recipientCommunity.name }}</h2>
|
||||
<BRow>
|
||||
<BCol sm="12" md="6">
|
||||
<p>{{ $t('gdd_per_link.no-account') }}</p>
|
||||
<BButton variant="primary" :to="routeWithParamsAndQuery('Register')">
|
||||
{{ $t('gdd_per_link.to-register') }}
|
||||
</BButton>
|
||||
</BCol>
|
||||
<BCol sm="12" md="6" class="mt-4 mt-lg-0">
|
||||
<p>{{ $t('gdd_per_link.has-account') }}</p>
|
||||
<BButton variant="gradido" :to="routeWithParamsAndQuery('Login')">
|
||||
{{ $t('gdd_per_link.to-login') }}
|
||||
</BButton>
|
||||
</BCol>
|
||||
</BRow>
|
||||
</div>
|
||||
|
||||
<BRow>
|
||||
<BCol sm="12" md="6">
|
||||
<p>{{ $t('gdd_per_link.no-account') }}</p>
|
||||
<BButton
|
||||
variant="primary"
|
||||
:disabled="isForeignCommunitySelected"
|
||||
:to="routeWithParamsAndQuery('Register')"
|
||||
>
|
||||
{{ $t('gdd_per_link.to-register') }}
|
||||
</BButton>
|
||||
</BCol>
|
||||
<BCol sm="12" md="6" class="mt-4 mt-lg-0">
|
||||
<p>{{ $t('gdd_per_link.has-account') }}</p>
|
||||
<BButton
|
||||
variant="gradido"
|
||||
:disabled="isForeignCommunitySelected"
|
||||
:to="routeWithParamsAndQuery('Login')"
|
||||
>
|
||||
{{ $t('gdd_per_link.to-login') }}
|
||||
</BButton>
|
||||
</BCol>
|
||||
</BRow>
|
||||
</BCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
{
|
||||
"|": "|",
|
||||
"(": "(",
|
||||
")": ")",
|
||||
"100": "100%",
|
||||
@ -7,6 +8,7 @@
|
||||
"85": "85%",
|
||||
"Chat": "Chat",
|
||||
"GDD": "GDD",
|
||||
"GDD-long": "Gradido",
|
||||
"GDT": "GDT",
|
||||
"GMS": {
|
||||
"title": "Geo Matching System GMS (in Entwicklung)",
|
||||
@ -272,15 +274,17 @@
|
||||
"no-redeem": "Du darfst deinen eigenen Link nicht einlösen!",
|
||||
"not-copied": "Dein Gerät lässt das Kopieren leider nicht zu! Bitte kopiere den Link von Hand!",
|
||||
"recipientCommunityFix": "Empfänger-Gemeinschaft des Link-Guthabens...",
|
||||
"recipientCommunitySelection": "Wähle deine Gemeinschaft zum Einlösen des Link-Guthabens...",
|
||||
"recipientCommunitySelection": "Gradido-Gemeinschaft wählen:",
|
||||
"recipientCommunityRedirection": "Zum Gutschreiben weiterleiten zu:",
|
||||
"redeem": "Einlösen",
|
||||
"redeem-community": "Gutschreiben auf ",
|
||||
"redeemed": "Erfolgreich eingelöst! Deinem Konto wurden {n} GDD gutgeschrieben.",
|
||||
"redeemed-at": "Der Link wurde bereits am {date} eingelöst.",
|
||||
"redeemlink-error": "Dieser Einlöse-Link ist nicht vollständig.",
|
||||
"switchCommunity": "Du hast eine andere Gemeinschaft ausgewählt...",
|
||||
"to-login": "Log dich ein",
|
||||
"to-register": "Registriere ein neues Konto.",
|
||||
"to-switch": "Wechsle zur Gemeinschaft",
|
||||
"to-switch": "Jetzt weiterleiten",
|
||||
"validUntil": "Gültig bis",
|
||||
"validUntilDate": "Der Link ist bis zum {date} gültig."
|
||||
},
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
{
|
||||
"|": "|",
|
||||
"(": "(",
|
||||
")": ")",
|
||||
"100": "100%",
|
||||
@ -7,6 +8,7 @@
|
||||
"85": "85%",
|
||||
"Chat": "Chat",
|
||||
"GDD": "GDD",
|
||||
"GDD-long": "Gradido",
|
||||
"GDT": "GDT",
|
||||
"GMS": {
|
||||
"title": "Geo Matching System GMS (in develop)",
|
||||
@ -272,15 +274,17 @@
|
||||
"no-redeem": "You not allowed to redeem your own link!",
|
||||
"not-copied": "Unfortunately, your device does not allow copying! Please copy the link by hand!",
|
||||
"recipientCommunityFix": "Recipient Community of the Link-Balance...",
|
||||
"recipientCommunitySelection": "Select your Community to redeem the link-deposit...",
|
||||
"recipientCommunitySelection": "Select Gradido community:",
|
||||
"recipientCommunityRedirection": "Redirect for crediting to:",
|
||||
"redeem": "Redeem",
|
||||
"redeem-community": "Redeem to ",
|
||||
"redeemed": "Successfully redeemed! Your account has been credited with {n} GDD.",
|
||||
"redeemed-at": "The link was already redeemed on {date}.",
|
||||
"redeemlink-error": "This redemption link is not complete.",
|
||||
"switchCommunity": "You have selected a foreign Community...",
|
||||
"to-login": "Log in",
|
||||
"to-register": "Register a new account.",
|
||||
"to-switch": "Switch to Community",
|
||||
"to-switch": "Redirect now",
|
||||
"validUntil": "Valid until",
|
||||
"validUntilDate": "The link is valid until {date}."
|
||||
},
|
||||
|
||||
@ -216,12 +216,15 @@
|
||||
"no-account": "Aún no tienes una cuenta de Gradido?",
|
||||
"no-redeem": "No puedes canjear tu propio enlace!",
|
||||
"not-copied": "¡Desafortunadamente, su dispositivo no permite copiar! Copie el enlace manualmente!",
|
||||
"recipientCommunityRedirection": "Redirigir para abonar a:",
|
||||
"recipientCommunitySelection": "Seleccionar comunidad Gradido:",
|
||||
"redeem": "Canjear",
|
||||
"redeemed": "¡Canjeado con éxito! Tu cuenta ha sido acreditada con {n} GDD.",
|
||||
"redeemed-at": "El enlace ya se canjeó el {date}.",
|
||||
"redeemed-title": "canjeado",
|
||||
"to-login": "iniciar sesión",
|
||||
"to-register": "Registre una nueva cuenta.",
|
||||
"to-switch": "Redirigir ahora",
|
||||
"validUntil": "Válido hasta",
|
||||
"validUntilDate": "El enlace es válido hasta el {date} ."
|
||||
},
|
||||
|
||||
@ -222,12 +222,15 @@
|
||||
"no-account": "Vous n'avez pas encore de compte Gradido?",
|
||||
"no-redeem": "Vous n'êtes pas autorisé à percevoir votre propre lien!",
|
||||
"not-copied": "Malheureusement votre appareil ne permet pas de copier! Veuillez copier le lien manuellement svp!",
|
||||
"recipientCommunityRedirection": "Pour créditer, rediriger vers:",
|
||||
"recipientCommunitySelection": "Choisir la communauté Gradido :",
|
||||
"redeem": "Encaisser",
|
||||
"redeemed": "Encaissé avec succès! Votre compte est crédité de {n} GDD.",
|
||||
"redeemed-at": "Le lien a déjà été perçu le {date}.",
|
||||
"redeemed-title": "encaisser",
|
||||
"to-login": "Connexion",
|
||||
"to-register": "Enregistrer un nouveau compte.",
|
||||
"to-switch": "Rediriger maintenant",
|
||||
"validUntil": "Valide jusqu'au",
|
||||
"validUntilDate": "Le lien est valide jusqu'au {date}."
|
||||
},
|
||||
|
||||
@ -216,12 +216,15 @@
|
||||
"no-account": "Je hebt nog geen Gradido rekening?",
|
||||
"no-redeem": "Je mag je eigen link niet inwisselen!",
|
||||
"not-copied": "Jouw apparaat laat het kopiëren helaas niet toe! Kopieer de link alsjeblieft met de hand!",
|
||||
"recipientCommunityRedirection": "Naar crediteren doorsturen naar:",
|
||||
"recipientCommunitySelection": "Gradido-gemeenschap selecteren:",
|
||||
"redeem": "Inwisselen",
|
||||
"redeemed": "Succesvol ingewisseld! Op jouw rekening werden {n} GDD bijgeschreven.",
|
||||
"redeemed-at": "De link werd al op {date} ingewisseld.",
|
||||
"redeemed-title": "ingewisseld",
|
||||
"to-login": "Inloggen",
|
||||
"to-register": "Registreer een nieuwe rekening.",
|
||||
"to-switch": "Nu doorsturen",
|
||||
"validUntil": "Geldig tot",
|
||||
"validUntilDate": "De link is geldig tot {date}."
|
||||
},
|
||||
|
||||
@ -116,8 +116,8 @@ const tokenExpiresInSeconds = computed(() => {
|
||||
})
|
||||
|
||||
const validLink = computed(() => {
|
||||
// console.log('TransactionLink.validLink... linkData.value.validUntil=', linkData.value.validUntil)
|
||||
// console.log('TransactionLink.validLink... new Date()=', new Date())
|
||||
console.log('TransactionLink.validLink... linkData.value.validUntil=', linkData.value.validUntil)
|
||||
console.log('TransactionLink.validLink... new Date()=', new Date())
|
||||
if (!isTransactionLinkLoaded.value) {
|
||||
return false
|
||||
}
|
||||
@ -125,75 +125,80 @@ const validLink = computed(() => {
|
||||
return false
|
||||
}
|
||||
const validUntilDate = new Date(linkData.value.validUntil)
|
||||
// console.log('TransactionLink.validLink... validUntilDate=', validUntilDate)
|
||||
// console.log('TransactionLink.validLink... new Date()=', new Date())
|
||||
// console.log(
|
||||
// 'TransactionLink.validLink... validUntilDate.getTime() >= new Date().getTime()=',
|
||||
// validUntilDate.getTime() >= new Date().getTime(),
|
||||
// )
|
||||
console.log('TransactionLink.validLink... validUntilDate=', validUntilDate)
|
||||
console.log('TransactionLink.validLink... new Date()=', new Date())
|
||||
console.log(
|
||||
'TransactionLink.validLink... validUntilDate.getTime() >= new Date().getTime()=',
|
||||
validUntilDate.getTime() >= new Date().getTime(),
|
||||
)
|
||||
return validUntilDate.getTime() >= new Date().getTime()
|
||||
})
|
||||
|
||||
const itemType = computed(() => {
|
||||
// console.log('TransactionLink.itemType... isTransactionLinkLoaded=', isTransactionLinkLoaded.value)
|
||||
console.log('TransactionLink.itemType... isTransactionLinkLoaded=', isTransactionLinkLoaded.value)
|
||||
if (isTransactionLinkLoaded.value) {
|
||||
// console.log('TransactionLink.itemType... linkData.value=', linkData.value)
|
||||
console.log('TransactionLink.itemType... linkData.value=', linkData.value)
|
||||
if (linkData.value.deletedAt) {
|
||||
// console.log('TransactionLink.itemType... TEXT_DELETED')
|
||||
console.log('TransactionLink.itemType... TEXT_DELETED')
|
||||
return 'TEXT_DELETED'
|
||||
}
|
||||
|
||||
const validUntilDate = new Date(linkData.value.validUntil)
|
||||
// console.log('TransactionLink.itemType... validUntilDate=', validUntilDate)
|
||||
// console.log('TransactionLink.itemType... new Date()=', new Date())
|
||||
// console.log(
|
||||
// 'TransactionLink.itemType... validUntilDate.getTime() < new Date().getTime()=',
|
||||
// validUntilDate.getTime() < new Date().getTime(),
|
||||
// )
|
||||
console.log('TransactionLink.itemType... validUntilDate=', validUntilDate)
|
||||
console.log('TransactionLink.itemType... new Date()=', new Date())
|
||||
console.log(
|
||||
'TransactionLink.itemType... validUntilDate.getTime() < new Date().getTime()=',
|
||||
validUntilDate.getTime() < new Date().getTime(),
|
||||
)
|
||||
if (validUntilDate.getTime() < new Date().getTime()) {
|
||||
// console.log('TransactionLink.itemType... TEXT_EXPIRED')
|
||||
console.log('TransactionLink.itemType... TEXT_EXPIRED')
|
||||
return 'TEXT_EXPIRED'
|
||||
}
|
||||
if (linkData.value.redeemedAt) {
|
||||
// console.log('TransactionLink.itemType... TEXT_REDEEMED')
|
||||
console.log('TransactionLink.itemType... TEXT_REDEEMED')
|
||||
return 'TEXT_REDEEMED'
|
||||
}
|
||||
if (linkData.value.deletedAt) {
|
||||
// console.log('TransactionLink.itemType... TEXT_DELETED')
|
||||
console.log('TransactionLink.itemType... TEXT_DELETED')
|
||||
return 'TEXT_DELETED'
|
||||
}
|
||||
if (store.state.token && store.state.tokenTime) {
|
||||
if (tokenExpiresInSeconds.value < 5) {
|
||||
// console.log('TransactionLink.itemType... REDEEM_SELECT_COMMUNITY')
|
||||
console.log(
|
||||
'TransactionLink.itemType... CONFIG.CROSS_TX_REDEEM_LINK_ACTIVE=',
|
||||
CONFIG.CROSS_TX_REDEEM_LINK_ACTIVE,
|
||||
)
|
||||
if (CONFIG.CROSS_TX_REDEEM_LINK_ACTIVE) {
|
||||
console.log('TransactionLink.itemType... REDEEM_SELECT_COMMUNITY')
|
||||
return 'REDEEM_SELECT_COMMUNITY'
|
||||
} else {
|
||||
console.log('TransactionLink.itemType... LOGGED_OUT')
|
||||
return 'LOGGED_OUT'
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log(
|
||||
// 'TransactionLink.itemType... linkData.value.recipientUser=',
|
||||
// linkData.value.recipientUser,
|
||||
// )
|
||||
// console.log('TransactionLink.itemType... linkData.value=', linkData.value)
|
||||
// console.log('TransactionLink.itemType... store.state.gradidoID=', store.state.gradidoID)
|
||||
// console.log('TransactionLink.itemType... isRedeemJwtLink=', isRedeemJwtLink.value)
|
||||
// console.log('TransactionLink.itemType... linkData.value.senderUser=', linkData.value.senderUser)
|
||||
// console.log(
|
||||
// 'TransactionLink.itemType... linkData.value.recipientUser.gradidoID=',
|
||||
// linkData.value.recipientUser?.gradidoID,
|
||||
// )
|
||||
// console.log(
|
||||
// 'TransactionLink.itemType... linkData.value.senderUser.gradidoID=',
|
||||
// linkData.value.senderUser?.gradidoID,
|
||||
// )
|
||||
console.log(
|
||||
'TransactionLink.itemType... linkData.value.recipientUser=',
|
||||
linkData.value.recipientUser,
|
||||
)
|
||||
console.log('TransactionLink.itemType... linkData.value=', linkData.value)
|
||||
console.log('TransactionLink.itemType... store.state.gradidoID=', store.state.gradidoID)
|
||||
console.log('TransactionLink.itemType... isRedeemJwtLink=', isRedeemJwtLink.value)
|
||||
console.log('TransactionLink.itemType... linkData.value.senderUser=', linkData.value.senderUser)
|
||||
console.log(
|
||||
'TransactionLink.itemType... linkData.value.recipientUser.gradidoID=',
|
||||
linkData.value.recipientUser?.gradidoID,
|
||||
)
|
||||
console.log(
|
||||
'TransactionLink.itemType... linkData.value.senderUser.gradidoID=',
|
||||
linkData.value.senderUser?.gradidoID,
|
||||
)
|
||||
if (
|
||||
linkData.value.senderUser &&
|
||||
linkData.value.recipientUser &&
|
||||
linkData.value.senderUser.gradidoID === linkData.value.recipientUser.gradidoID
|
||||
) {
|
||||
// console.log('TransactionLink.itemType... SELF_CREATOR')
|
||||
console.log('TransactionLink.itemType... SELF_CREATOR')
|
||||
return 'SELF_CREATOR'
|
||||
}
|
||||
if (
|
||||
@ -202,31 +207,36 @@ const itemType = computed(() => {
|
||||
linkData.value.senderUser.gradidoID !== linkData.value.recipientUser.gradidoID &&
|
||||
store.state.gradidoID === linkData.value.recipientUser.gradidoID
|
||||
) {
|
||||
// console.log('TransactionLink.itemType... VALID')
|
||||
// console.log('TransactionLink.itemType... linkData.value=', linkData.value)
|
||||
// console.log('TransactionLink.itemType... store.state.gradidoID=', store.state.gradidoID)
|
||||
// console.log(
|
||||
// 'TransactionLink.itemType... linkData.value.recipientUser.gradidoID=',
|
||||
// linkData.value.recipientUser.gradidoID,
|
||||
// )
|
||||
// console.log(
|
||||
// 'TransactionLink.itemType... linkData.value.senderUser.gradidoID=',
|
||||
// linkData.value.senderUser.gradidoID,
|
||||
// )
|
||||
console.log('TransactionLink.itemType... VALID')
|
||||
console.log('TransactionLink.itemType... linkData.value=', linkData.value)
|
||||
console.log('TransactionLink.itemType... store.state.gradidoID=', store.state.gradidoID)
|
||||
console.log(
|
||||
'TransactionLink.itemType... linkData.value.recipientUser.gradidoID=',
|
||||
linkData.value.recipientUser.gradidoID,
|
||||
)
|
||||
console.log(
|
||||
'TransactionLink.itemType... linkData.value.senderUser.gradidoID=',
|
||||
linkData.value.senderUser.gradidoID,
|
||||
)
|
||||
return 'VALID'
|
||||
}
|
||||
}
|
||||
console.log(
|
||||
'TransactionLink.itemType... vor last return CONFIG.CROSS_TX_REDEEM_LINK_ACTIVE=',
|
||||
CONFIG.CROSS_TX_REDEEM_LINK_ACTIVE,
|
||||
)
|
||||
if (CONFIG.CROSS_TX_REDEEM_LINK_ACTIVE) {
|
||||
// console.log('TransactionLink.itemType...last return= REDEEM_SELECT_COMMUNITY')
|
||||
console.log('TransactionLink.itemType...last return= REDEEM_SELECT_COMMUNITY')
|
||||
return 'REDEEM_SELECT_COMMUNITY'
|
||||
} else {
|
||||
console.log('TransactionLink.itemType... last return= LOGGED_OUT')
|
||||
return 'LOGGED_OUT'
|
||||
}
|
||||
})
|
||||
|
||||
const itemTypeExt = computed(() => {
|
||||
// console.log('TransactionLink.itemTypeExt... itemType=', itemType.value)
|
||||
// console.log('TransactionLink.itemTypeExt... validLink=', validLink.value)
|
||||
console.log('TransactionLink.itemTypeExt... itemType=', itemType.value)
|
||||
console.log('TransactionLink.itemTypeExt... validLink=', validLink.value)
|
||||
if (itemType.value.startsWith('TEXT')) {
|
||||
return 'TEXT'
|
||||
}
|
||||
@ -234,13 +244,13 @@ const itemTypeExt = computed(() => {
|
||||
})
|
||||
|
||||
watch(itemType, (newItemType) => {
|
||||
// console.log('TransactionLink.watch... itemType=', itemType.value)
|
||||
// console.log('TransactionLink.watch... validLink=', validLink.value)
|
||||
console.log('TransactionLink.watch... itemType=', itemType.value)
|
||||
console.log('TransactionLink.watch... validLink=', validLink.value)
|
||||
updateRedeemedBoxText(newItemType)
|
||||
})
|
||||
|
||||
function updateRedeemedBoxText(type) {
|
||||
// console.log('TransactionLink.updateRedeemedBoxText... type=', type)
|
||||
console.log('TransactionLink.updateRedeemedBoxText... type=', type)
|
||||
switch (type) {
|
||||
case 'TEXT_DELETED':
|
||||
redeemedBoxText.value = t('gdd_per_link.link-deleted', {
|
||||
@ -260,18 +270,18 @@ function updateRedeemedBoxText(type) {
|
||||
default:
|
||||
redeemedBoxText.value = ''
|
||||
}
|
||||
// console.log('TransactionLink.updateRedeemedBoxText... redeemedBoxText=', redeemedBoxText)
|
||||
console.log('TransactionLink.updateRedeemedBoxText... redeemedBoxText=', redeemedBoxText)
|
||||
}
|
||||
|
||||
const emit = defineEmits(['set-mobile-start'])
|
||||
|
||||
onMounted(() => {
|
||||
// console.log('TransactionLink.onMounted... params=', params)
|
||||
console.log('TransactionLink.onMounted... params=', params)
|
||||
emit('set-mobile-start', false)
|
||||
})
|
||||
|
||||
onResult(() => {
|
||||
// console.log('TransactionLink.onResult... result=', result.value)
|
||||
console.log('TransactionLink.onResult... result=', result.value)
|
||||
// console.log('TransactionLink.onResult... stringify result=', JSON.stringify(result.value))
|
||||
if (result.value?.queryTransactionLink?.__typename === 'TransactionLink') {
|
||||
// console.log('TransactionLink.onResult... TransactionLink')
|
||||
@ -291,17 +301,17 @@ onResult(() => {
|
||||
})
|
||||
|
||||
onError(() => {
|
||||
// console.log('TransactionLink.onError... error=', error)
|
||||
console.log('TransactionLink.onError... error=', error)
|
||||
toastError(t('gdd_per_link.redeemlink-error'))
|
||||
})
|
||||
|
||||
function setTransactionLinkInformation() {
|
||||
// console.log('TransactionLink.setTransactionLinkInformation... result=', result.value)
|
||||
console.log('TransactionLink.setTransactionLinkInformation... result=', result.value)
|
||||
// const queryTransactionLink = result.value.queryTransactionLink
|
||||
const deepCopy = JSON.parse(JSON.stringify(result.value))
|
||||
// console.log('TransactionLink.setTransactionLinkInformation... deepCopy=', deepCopy)
|
||||
console.log('TransactionLink.setTransactionLinkInformation... deepCopy=', deepCopy)
|
||||
if (deepCopy && deepCopy.queryTransactionLink.__typename === 'TransactionLink') {
|
||||
// console.log('TransactionLink.setTransactionLinkInformation... typename === TransactionLink')
|
||||
console.log('TransactionLink.setTransactionLinkInformation... typename === TransactionLink')
|
||||
// recipientUser is only set if the user is logged in
|
||||
if (store.state.gradidoID !== null) {
|
||||
// console.log(
|
||||
@ -320,7 +330,7 @@ function setTransactionLinkInformation() {
|
||||
// )
|
||||
}
|
||||
linkData.value = deepCopy.queryTransactionLink
|
||||
// console.log('TransactionLink.setTransactionLinkInformation... linkData.value=', linkData.value)
|
||||
console.log('TransactionLink.setTransactionLinkInformation... linkData.value=', linkData.value)
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,13 +344,13 @@ function setContributionLinkInformation() {
|
||||
}
|
||||
|
||||
function setRedeemJwtLinkInformation() {
|
||||
// console.log('TransactionLink.setRedeemJwtLinkInformation... result=', result.value)
|
||||
console.log('TransactionLink.setRedeemJwtLinkInformation... result=', result.value)
|
||||
const deepCopy = JSON.parse(JSON.stringify(result.value))
|
||||
// console.log('TransactionLink.setRedeemJwtLinkInformation... deepCopy=', deepCopy)
|
||||
console.log('TransactionLink.setRedeemJwtLinkInformation... deepCopy=', deepCopy)
|
||||
if (deepCopy) {
|
||||
// recipientUser is only set if the user is logged in
|
||||
console.log('TransactionLink.setRedeemJwtLinkInformation... recipientUser is only set if the user is logged in')
|
||||
if (store.state.gradidoID !== null) {
|
||||
// console.log('TransactionLink.setRedeemJwtLinkInformation... gradidoID=', store.state.gradidoID)
|
||||
console.log('TransactionLink.setRedeemJwtLinkInformation... gradidoID=', store.state.gradidoID)
|
||||
deepCopy.queryTransactionLink.recipientUser = {
|
||||
__typename: 'User',
|
||||
gradidoID: store.state.gradidoID,
|
||||
@ -348,21 +358,21 @@ function setRedeemJwtLinkInformation() {
|
||||
alias: store.state.alias,
|
||||
}
|
||||
}
|
||||
// console.log(
|
||||
// 'TransactionLink.setRedeemJwtLinkInformation... deepCopy.queryTransactionLink.recipientUser=',
|
||||
// deepCopy.queryTransactionLink.recipientUser,
|
||||
// )
|
||||
console.log(
|
||||
'TransactionLink.setRedeemJwtLinkInformation... deepCopy.queryTransactionLink.recipientUser=',
|
||||
deepCopy.queryTransactionLink.recipientUser,
|
||||
)
|
||||
linkData.value = deepCopy.queryTransactionLink
|
||||
// console.log('TransactionLink.setRedeemJwtLinkInformation... linkData.value=', linkData.value)
|
||||
console.log('TransactionLink.setRedeemJwtLinkInformation... linkData.value=', linkData.value)
|
||||
}
|
||||
}
|
||||
|
||||
async function mutationLink(amount) {
|
||||
// console.log('TransactionLink.mutationLink... params=', params)
|
||||
// console.log('TransactionLink.mutationLink... linkData.value=', linkData.value)
|
||||
// console.log('TransactionLink.mutationLink... linkData=', linkData)
|
||||
console.log('TransactionLink.mutationLink... params=', params)
|
||||
console.log('TransactionLink.mutationLink... linkData.value=', linkData.value)
|
||||
console.log('TransactionLink.mutationLink... linkData=', linkData)
|
||||
if (isRedeemJwtLink.value) {
|
||||
// console.log('TransactionLink.mutationLink... trigger disbursement from recipient-community')
|
||||
console.log('TransactionLink.mutationLink... trigger disbursement from recipient-community')
|
||||
try {
|
||||
await disburseMutate({
|
||||
senderCommunityUuid: linkData.value.senderCommunity.uuid,
|
||||
@ -384,7 +394,7 @@ async function mutationLink(amount) {
|
||||
await router.push('/overview')
|
||||
}
|
||||
} else {
|
||||
// console.log('TransactionLink.mutationLink... local transaction or contribution')
|
||||
console.log('TransactionLink.mutationLink... local transaction or contribution')
|
||||
try {
|
||||
await redeemMutate({
|
||||
code: redeemCode.value,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user