diff --git a/composables/useApiFetch.ts b/composables/useApiFetch.ts index 45ff7c8..a201b70 100644 --- a/composables/useApiFetch.ts +++ b/composables/useApiFetch.ts @@ -1,5 +1,5 @@ -import { StorageSerializers } from "@vueuse/core"; -import { UseFetchOptions } from "nuxt/app"; +import { AsyncData, UseFetchOptions } from "#app"; +import { NitroFetchRequest } from "nitropack"; const useApiFetch = async (url: string, options?: any) => { // const { token } = useAuth(); @@ -32,13 +32,13 @@ const useApiFetch = async (url: string, options?: any) => { // } else { // console.log(`Getting value from cache for ${url}`); // } - const data = await useFetch("/api" + url, { + console.log(`API => /api${url}`); + return (await useFetch(`/api${url}`, { + // @ts-ignore method: "get", headers: head, ...options, - }); - - return data; + })) as AsyncData; }; export default useApiFetch;