11 lines
304 B
TypeScript
11 lines
304 B
TypeScript
import type { $Fetch, SearchParameters } from 'ofetch';
|
|
|
|
export async function fetchWithRepo<T>(
|
|
fetcher: $Fetch,
|
|
url: string,
|
|
method: 'GET' | 'POST' | 'PUT' | 'DELETE' = 'GET',
|
|
body?: any,
|
|
params?: SearchParameters
|
|
): Promise<T> {
|
|
return await fetcher(url, { method, body, params });
|
|
} |