Skip to content

Commit bc28a39

Browse files
fix: response type for useKirbyData composable
1 parent 6441df0 commit bc28a39

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/runtime/composables/useKirbyData.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { computed } from 'vue'
22
import { hash } from 'ohash'
3-
import type { UseFetchOptions } from 'nuxt/app'
3+
import type { FetchError } from 'ohmyfetch'
4+
import type { NitroFetchRequest } from 'nitropack'
5+
import type { AsyncData, UseFetchOptions } from 'nuxt/app'
46
import { headersToObject, kirbyApiRoute, resolveUnref } from '../utils'
57
import type { MaybeComputedRef } from '../utils'
68
import { useFetch } from '#imports'
@@ -23,13 +25,13 @@ export function useKirbyData<T = any>(
2325
) {
2426
const _uri = computed(() => resolveUnref(uri).replace(/^\//, ''))
2527

26-
return useFetch<T>(kirbyApiRoute, {
28+
return useFetch<T, FetchError, NitroFetchRequest, T>(kirbyApiRoute, {
2729
...opts,
2830
key: hash(_uri.value),
2931
method: 'POST',
3032
body: {
3133
uri: _uri.value,
3234
headers: headersToObject(opts.headers),
3335
},
34-
})
36+
}) as AsyncData<T, true | FetchError>
3537
}

0 commit comments

Comments
 (0)