mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-20 08:15:59 +00:00
refactor(nuxt): explicitly type internal request fetch
This commit is contained in:
parent
b4e012a83d
commit
54cb803191
@ -1,5 +1,5 @@
|
|||||||
import type { FetchError, FetchOptions } from 'ofetch'
|
import type { FetchError, FetchOptions } from 'ofetch'
|
||||||
import type { NitroFetchRequest, TypedInternalResponse, AvailableRouterMethod as _AvailableRouterMethod } from 'nitropack'
|
import type { $Fetch, H3Event$Fetch, NitroFetchRequest, TypedInternalResponse, AvailableRouterMethod as _AvailableRouterMethod } from 'nitropack'
|
||||||
import type { MaybeRef, Ref } from 'vue'
|
import type { MaybeRef, Ref } from 'vue'
|
||||||
import { computed, reactive, toValue } from 'vue'
|
import { computed, reactive, toValue } from 'vue'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
@ -171,7 +171,7 @@ export function useFetch<
|
|||||||
controller.signal.onabort = () => clearTimeout(timeoutId)
|
controller.signal.onabort = () => clearTimeout(timeoutId)
|
||||||
}
|
}
|
||||||
|
|
||||||
let _$fetch = opts.$fetch || globalThis.$fetch
|
let _$fetch: H3Event$Fetch | $Fetch<unknown, NitroFetchRequest> = opts.$fetch || globalThis.$fetch
|
||||||
|
|
||||||
// Use fetch with request context and headers for server direct API calls
|
// Use fetch with request context and headers for server direct API calls
|
||||||
if (import.meta.server && !opts.$fetch) {
|
if (import.meta.server && !opts.$fetch) {
|
||||||
|
Loading…
Reference in New Issue
Block a user