mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 13:06:01 +00:00
complete removed axiosInstance
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import resolveApi, { resolveApiHeaders } from './resolveApi';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export async function apiCall(route: string, args: {} = undefined) {
|
||||
const resp = await fetch(`${resolveApi()}/${route}`, {
|
||||
@@ -16,3 +17,15 @@ export async function apiCall(route: string, args: {} = undefined) {
|
||||
export function apiOn(event: string, hander: Function) {}
|
||||
|
||||
export function apiOff(event: string, hander: Function) {}
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
export function useApiCall(route, args, defaultValue) {
|
||||
const result = writable(defaultValue);
|
||||
|
||||
apiCall(route, args).then(resp => {
|
||||
result.set(resp);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user