Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
felixcicatt committed Oct 29, 2024
1 parent 8cd3ea7 commit 48498ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion odpc.client/src/composables/use-all-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ const fetchAllPages = async <T>(url: string, signal?: AbortSignal | undefined):
export const useAllPages = <T>(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<T>(url, abortController.signal).catch(() => {
error.value = true;
return [] as T[];
Expand Down

0 comments on commit 48498ed

Please sign in to comment.