From 5fcd3fc7681d3e350432d0117ceab2d4e9117de3 Mon Sep 17 00:00:00 2001 From: FragginWagon Date: Wed, 28 Jan 2026 22:14:59 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Improve=20code=20formatting=20an?= =?UTF-8?q?d=20readability=20in=20useAsyncState=20composable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/composables/useAsyncState.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/code/websites/pokedex.online/src/composables/useAsyncState.js b/code/websites/pokedex.online/src/composables/useAsyncState.js index 99d9aff..26f566a 100644 --- a/code/websites/pokedex.online/src/composables/useAsyncState.js +++ b/code/websites/pokedex.online/src/composables/useAsyncState.js @@ -1,9 +1,9 @@ /** * useAsyncState Composable - * + * * Manages loading/error/success states for async operations * Consolidates pattern used across 13+ components - * + * * @example * const { execute, loading, error, data, isSuccess } = useAsyncState(); * await execute(async () => { @@ -27,9 +27,13 @@ export function useAsyncState(options = {}) { const data = ref(initialData); const abortController = ref(null); - const isSuccess = computed(() => !loading.value && !error.value && data.value !== null); + const isSuccess = computed( + () => !loading.value && !error.value && data.value !== null + ); const isError = computed(() => !loading.value && error.value !== null); - const isIdle = computed(() => !loading.value && error.value === null && data.value === null); + const isIdle = computed( + () => !loading.value && error.value === null && data.value === null + ); /** * Execute an async function with state management @@ -74,7 +78,9 @@ export function useAsyncState(options = {}) { // If more retries remaining, wait before retrying if (attempt <= retries) { - await new Promise(resolve => setTimeout(resolve, retryDelay * attempt)); + await new Promise(resolve => + setTimeout(resolve, retryDelay * attempt) + ); } } }