kun-galgame-vue/src/utils/request.ts

11 lines
211 B
TypeScript
Raw Normal View History

// request.ts
export async function request<T>(
url: string,
options: RequestInit = {}
): Promise<T> {
const response = await fetch(url, options)
const data = await response.json()
return data as T
}