replaced call socket() with apiOn/apiOff

This commit is contained in:
Jan Prochazka
2021-12-22 11:24:48 +01:00
parent 05ea435820
commit 2ace0bdb34
13 changed files with 41 additions and 46 deletions

View File

@@ -8,7 +8,7 @@ import { DatabaseInfo } from 'dbgate-types';
import { derived } from 'svelte/store';
import { extendDatabaseInfo } from 'dbgate-tools';
import { setLocalStorage } from '../utility/storageCache';
import { apiCall } from './api';
import { apiCall, apiOff, apiOn } from './api';
const databaseInfoLoader = ({ conid, database }) => ({
url: 'database-connections/structure',
@@ -200,11 +200,11 @@ function useCore(loader, args) {
handleReload();
if (reloadTrigger && socket) {
for (const item of getAsArray(reloadTrigger)) {
socket().on(item, handleReload);
apiOn(item, handleReload);
}
return () => {
for (const item of getAsArray(reloadTrigger)) {
socket().off(item, handleReload);
apiOff(item, handleReload);
}
};
}