From 322e4ca37fef8f1e034013e2934284e8138affce Mon Sep 17 00:00:00 2001
From: clauspeterhuebner
Date: Thu, 24 Apr 2025 14:34:26 +0200
Subject: [PATCH] treat validUntil as Date in case of DisbursementLink too
---
backend/src/graphql/model/DisbursementLink.ts | 8 ++++----
frontend/src/pages/TransactionLink.vue | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/backend/src/graphql/model/DisbursementLink.ts b/backend/src/graphql/model/DisbursementLink.ts
index e09efb83f..a578a4d62 100644
--- a/backend/src/graphql/model/DisbursementLink.ts
+++ b/backend/src/graphql/model/DisbursementLink.ts
@@ -1,5 +1,5 @@
import { Decimal } from 'decimal.js-light'
-import { ObjectType, Field, Int } from 'type-graphql'
+import { ObjectType, Field } from 'type-graphql'
import { DisbursementJwtPayloadType } from '@/auth/jwt/payloadtypes/DisbursementJwtPayloadType'
@@ -27,7 +27,7 @@ export class DisbursementLink {
this.memo = disbursementPayload.memo
this.code = disbursementPayload.redeemcode
if (disbursementPayload.exp) {
- this.validUntil = disbursementPayload.exp * 1000
+ this.validUntil = new Date(disbursementPayload.exp * 1000)
}
}
@@ -52,6 +52,6 @@ export class DisbursementLink {
@Field(() => String)
code: string
- @Field(() => Int)
- validUntil: number
+ @Field(() => Date)
+ validUntil: Date
}
diff --git a/frontend/src/pages/TransactionLink.vue b/frontend/src/pages/TransactionLink.vue
index 4e422a330..8b46a6326 100644
--- a/frontend/src/pages/TransactionLink.vue
+++ b/frontend/src/pages/TransactionLink.vue
@@ -104,8 +104,8 @@ const tokenExpiresInSeconds = computed(() => {
const validLink = computed(() => {
console.log('TransactionLink.validLink... linkData.value.validUntil=', linkData.value.validUntil)
- console.log('TransactionLink.validLink... new Date().getTime()=', new Date().getTime())
- return new Date(linkData.value.validUntil) > new Date()
+ console.log('TransactionLink.validLink... new Date()=', new Date())
+ return linkData.value.validUntil > new Date()
})
const itemType = computed(() => {
@@ -113,7 +113,7 @@ const itemType = computed(() => {
console.log('TransactionLink.itemType... TEXT_DELETED')
return 'TEXT_DELETED'
}
- if (new Date(linkData.value.validUntil) < new Date()) {
+ if (linkData.value.validUntil < new Date()) {
console.log('TransactionLink.itemType... TEXT_EXPIRED')
return 'TEXT_EXPIRED'
}
@@ -165,7 +165,7 @@ function updateRedeemedBoxText(type) {
break
case 'TEXT_EXPIRED':
redeemedBoxText.value = t('gdd_per_link.link-expired', {
- date: d(new Date(linkData.value.validUntil), 'long'),
+ date: d(linkData.value.validUntil, 'long'),
})
break
case 'TEXT_REDEEMED':