mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 13:06:01 +00:00
apiCall POC
This commit is contained in:
18
packages/web/src/utility/api.ts
Normal file
18
packages/web/src/utility/api.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import resolveApi, { resolveApiHeaders } from './resolveApi';
|
||||
|
||||
export async function apiCall(route: string, args: {} = undefined) {
|
||||
const resp = await fetch(`${resolveApi()}/${route}`, {
|
||||
method: 'POST',
|
||||
cache: 'no-cache',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...resolveApiHeaders(),
|
||||
},
|
||||
body: JSON.stringify(args),
|
||||
});
|
||||
return resp.json();
|
||||
}
|
||||
|
||||
export function apiOn(event: string, hander: Function) {}
|
||||
|
||||
export function apiOff(event: string, hander: Function) {}
|
||||
Reference in New Issue
Block a user