Skip to content

Commit 6647391

Browse files
committed
feat: composable open fetch
1 parent 143f5b1 commit 6647391

File tree

2 files changed

+8
-175
lines changed

2 files changed

+8
-175
lines changed

src/composables/use-open-fetch.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import {
55
createFetch,
66
} from '@vueuse/core'
77
import { type MaybeRefOrGetter, toValue } from 'vue'
8-
import type {
9-
FetchResponseData,
10-
FilterMethods,
11-
ParamsOption,
12-
RequestBodyOption,
8+
import {
9+
type FetchResponseData,
10+
type FilterMethods,
11+
type ParamsOption,
12+
type RequestBodyOption,
13+
createOpenFetch,
1314
} from '#/utils/fetch'
1415

1516
type MethodOption<M, P> = 'get' extends keyof P ? { method?: M } : { method: M }
@@ -44,7 +45,7 @@ export type UseOpenFetchClient<Paths> = <
4445
ResT = FetchResponseData<Methods[DefaultMethod]>,
4546
>(
4647
path: Path | (() => Path),
47-
options: RequestInit & UseOpenFetchOptions<Method, LowercasedMethod, Methods>,
48+
options: UseOpenFetchOptions<Method, LowercasedMethod, Methods>,
4849
useFetchOptions?: UseFetchOptions,
4950
) => UseFetchReturn<ResT> & PromiseLike<UseFetchReturn<ResT>>
5051

@@ -62,7 +63,7 @@ export function createUseOpenFetch<Paths>(
6263

6364
return (
6465
url: MaybeRefOrGetter<string>,
65-
requests: RequestInit,
66+
requests: any, //TODO: find a way to type this
6667
useFetchOptions?: UseFetchOptions,
6768
) => {
6869
return useFetch(toValue(url), requests, useFetchOptions)

src/composables/use-query.ts

Lines changed: 0 additions & 168 deletions
This file was deleted.

0 commit comments

Comments
 (0)