mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 01:16:01 +00:00
query grid
This commit is contained in:
@@ -8,7 +8,6 @@ export default function memberStore(store, extractStore) {
|
||||
if (unsubscribeSub) unsubscribeSub();
|
||||
unsubscribeSub = subStore.subscribe(subValue => {
|
||||
if (res) {
|
||||
console.log('subValue', subValue);
|
||||
res.set(subValue);
|
||||
} else {
|
||||
res = writable(subValue);
|
||||
|
||||
21
packages/web/src/utility/useFetch.ts
Normal file
21
packages/web/src/utility/useFetch.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import _ from 'lodash';
|
||||
import axios from './axios';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export default function useFetch({ url, data = undefined, params = undefined, defaultValue = undefined, ...config }) {
|
||||
const result = writable(defaultValue);
|
||||
|
||||
axios
|
||||
.request({
|
||||
method: 'get',
|
||||
params,
|
||||
url,
|
||||
data,
|
||||
...config,
|
||||
})
|
||||
.then(resp => {
|
||||
result.set(resp.data);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user