Skip to content

Commit

Permalink
fix: move after token_expired as it's used within.
Browse files Browse the repository at this point in the history
  • Loading branch information
codiam committed May 8, 2023
1 parent ddaaa65 commit 9ff4c19
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/runtime/composables/useDirectusToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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(),
Expand Down

0 comments on commit 9ff4c19

Please sign in to comment.