☙◦ The Tablet ❀ GamerGirlandCo ◦❧
3640c0db11
extend useFetch with a helper that prepends `/api` to the url, as well as makes the default http method "GET"
11 lines
275 B
TypeScript
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 |