From 193ebb5cfb7b64eb137e03a49e983657bcb94516 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sun, 25 Jun 2023 18:58:40 +0200 Subject: [PATCH] different way of removing magic numbers --- webclient/src/composables/feedbackToken.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webclient/src/composables/feedbackToken.ts b/webclient/src/composables/feedbackToken.ts index 87359edc5..2c91957d5 100644 --- a/webclient/src/composables/feedbackToken.ts +++ b/webclient/src/composables/feedbackToken.ts @@ -37,8 +37,8 @@ export function useFeedbackToken(): { // Token are renewed much before being invalid on the server. const MS_PER_HOUR = 3600000; - const TOKEN_VALIDITY_MS = MS_PER_HOUR * 6; - if (token.value === null || Date.now() - token.value.created_at > TOKEN_VALIDITY_MS) { + const TOKEN_VALIDITY_FRONTEND_HOURS = 6; + if (token.value === null || Date.now() - token.value.created_at > TOKEN_VALIDITY_FRONTEND_HOURS * MS_PER_HOUR) { fetch(`/api/feedback/get_token`, { method: "POST" }) .then((r) => { if (r.status === TokenStatus.SUCCESSFULLY_CREATED) {