From 9ff4c195842f9a315aec93192d79daec68c37648 Mon Sep 17 00:00:00 2001 From: Cory Date: Mon, 8 May 2023 17:28:15 +0100 Subject: [PATCH] fix: move after token_expired as it's used within. --- src/runtime/composables/useDirectusToken.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/runtime/composables/useDirectusToken.ts b/src/runtime/composables/useDirectusToken.ts index 1cdf4426..58043565 100644 --- a/src/runtime/composables/useDirectusToken.ts +++ b/src/runtime/composables/useDirectusToken.ts @@ -59,6 +59,9 @@ export const useDirectusToken = () => { } } + const token_expires_in = computed(() => Math.max(0, (expires().value ?? 0) - new Date().getTime())); + + const token_expired = computed(() => !token().value || token_expires_in.value == 0); const checkAutoRefresh = async () => { if (config.directus.autoRefresh) { @@ -75,10 +78,6 @@ export const useDirectusToken = () => { } } - const token_expires_in = computed(() => Math.max(0, (expires().value ?? 0) - new Date().getTime())); - - const token_expired = computed(() => !token().value || token_expires_in.value == 0); - return { token: token(), refreshToken: refreshToken(),