Closed jonkri closed 1 week ago
Trying out this code on https://nuxt-open-fetch.vercel.app/advanced/custom-client I encountered two errors:
import type { NitroApp } from "nitropack"; import { createOpenFetch, useRuntimeConfig } from "#imports"; type NitroAppPlugin = (nitro: NitroApp) => void; // Workaround to add another property to NitroApp function defineNitroPlugin(def: NitroAppPlugin): NitroAppPlugin { return def; } export default defineNitroPlugin(({ localFetch }) => { const clients = useRuntimeConfig().public.openFetch; Object.entries(clients).forEach(([name, options]) => { nitroApp[`$${name}`] = createOpenFetch(options, localFetch); }); });
Both errors are on this line:
nitroApp[`$${name}`] = createOpenFetch(options, localFetch);
The first error is:
Cannot find name 'nitroApp'.
The second error is:
Argument of type '(input: string | Request, init: FetchOptions) => Promise<Response>' is not assignable to parameter of type '$Fetch<unknown, NitroFetchRequest>'.
Related to #46.
Fixed the docs - https://nuxt-open-fetch.vercel.app/advanced/custom-client.
Thanks :)
Trying out this code on https://nuxt-open-fetch.vercel.app/advanced/custom-client I encountered two errors:
Both errors are on this line:
The first error is:
The second error is:
Related to #46.