🎨 Improve code formatting and readability in useAsyncState composable

This commit is contained in:
2026-01-28 22:14:59 +00:00
parent d7207e5014
commit 5fcd3fc768

View File

@@ -27,9 +27,13 @@ export function useAsyncState(options = {}) {
const data = ref(initialData); const data = ref(initialData);
const abortController = ref(null); 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 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 * Execute an async function with state management
@@ -74,7 +78,9 @@ export function useAsyncState(options = {}) {
// If more retries remaining, wait before retrying // If more retries remaining, wait before retrying
if (attempt <= retries) { if (attempt <= retries) {
await new Promise(resolve => setTimeout(resolve, retryDelay * attempt)); await new Promise(resolve =>
setTimeout(resolve, retryDelay * attempt)
);
} }
} }
} }