Skip to content

Commit 9eb6bad

Browse files
committed
chore: Типизация в usePagination
1 parent a0f5c78 commit 9eb6bad

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"csrftoken",
1212
"defu",
1313
"dompurify",
14+
"ofetch",
1415
"ohash",
1516
"vitepress"
1617
],

src/runtime/composables/usePagination.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { UseFetchOptions } from "#app"
22
import type { Ref } from "#imports"
3+
import type { FetchError } from "ofetch"
34

5+
// @ts-expect-error - свойства добавятся в итоговом проекте
46
import { ref, toReactive, useFetch, useFetchAuth, watch } from "#imports"
57
import { defu } from "defu"
68
import { hash } from "ohash"
@@ -132,7 +134,7 @@ export default async function <TResponse>(
132134
addResults(data.value?.results)
133135
checkLastPage(data.value?.next)
134136
})
135-
.catch((error) => {
137+
.catch((error: FetchError) => {
136138
alert(error)
137139
})
138140
}
@@ -150,7 +152,7 @@ export default async function <TResponse>(
150152
replaceResults(data.value?.results)
151153
checkLastPage(data.value?.next)
152154
})
153-
.catch((error) => {
155+
.catch((error: FetchError) => {
154156
alert(error)
155157
})
156158
})

0 commit comments

Comments
 (0)