mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
nothing
This commit is contained in:
13
src/api/query.ts
Normal file
13
src/api/query.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/* eslint-disable indent */
|
||||
import { APIRoot } from './api-models';
|
||||
|
||||
export default async function QueryAPI<T>(url: string, body?: unknown): Promise<APIRoot<T>> {
|
||||
const data = await fetch(url,{
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(body)
|
||||
}); // 不处理异常, 在页面处理
|
||||
return await data.json() as APIRoot<T>;
|
||||
}
|
||||
Reference in New Issue
Block a user