From 48498ed9bbf4ff54335c1e680db5598ea80d5969 Mon Sep 17 00:00:00 2001 From: Felix Cornelissen Date: Tue, 29 Oct 2024 10:16:21 +0100 Subject: [PATCH] cleanup --- odpc.client/src/composables/use-all-pages.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/odpc.client/src/composables/use-all-pages.ts b/odpc.client/src/composables/use-all-pages.ts index 2ea281d..68849de 100644 --- a/odpc.client/src/composables/use-all-pages.ts +++ b/odpc.client/src/composables/use-all-pages.ts @@ -16,10 +16,12 @@ const fetchAllPages = async (url: string, signal?: AbortSignal | undefined): export const useAllPages = (url: string) => { const error = ref(false); const loading = ref(true); - const abortController = new AbortController(); const data = asyncComputed( (onCancel) => { + const abortController = new AbortController(); + onCancel(() => abortController.abort()); + return fetchAllPages(url, abortController.signal).catch(() => { error.value = true; return [] as T[];