next/composables/useApiFetch.ts
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 3640c0db11
feat(composables): add fetch helper function
extend useFetch with a helper that prepends `/api` to the url, as well as makes the default http method "GET"
2023-09-25 19:23:37 -04:00

11 lines
275 B
TypeScript

import { UseFetchOptions } from "nuxt/app";
const useApiFetch = async (url: string, options?: any) => {
const at = useCookie("rockfic_cookie", {default: undefined})
return useFetch("/api" + url, {
method: "get",
...options,
})
}
export default useApiFetch