add checking token expiration time to TransactionLink.vue

This commit is contained in:
mahula 2022-10-06 18:05:04 +02:00
parent 8a8ffccd71
commit 0b7313d216

View File

@ -103,6 +103,12 @@ export default {
isContributionLink() {
return this.$route.params.code.search(/^CL-/) === 0
},
tokenExpiresInSeconds() {
const remainingSecs = Math.floor(
(new Date(this.$store.state.tokenTime * 1000).getTime() - new Date().getTime()) / 1000,
)
return remainingSecs <= 0 ? 0 : remainingSecs
},
itemType() {
// link is deleted: at, from
if (this.linkData.deletedAt) {
@ -130,7 +136,9 @@ export default {
return `TEXT`
}
if (this.$store.state.token) {
if (this.$store.state.token && this.$store.state.tokenTime) {
if (this.tokenExpiresInSeconds < 5) return `LOGGED_OUT`
// logged in, nicht berechtigt einzulösen, eigener link
if (this.linkData.user && this.$store.state.email === this.linkData.user.email) {
return `SELF_CREATOR`