mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 17:46:00 +00:00
axiosInstance replaced with apiCall
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
import InputTextModal from '../modals/InputTextModal.svelte';
|
||||
import { showModal } from '../modals/modalTools';
|
||||
import { currentArchive } from '../stores';
|
||||
import { apiCall } from '../utility/api';
|
||||
import { markArchiveFileAsDataSheet } from '../utility/archiveTools';
|
||||
import axiosInstance from '../utility/axiosInstance';
|
||||
import { useArchiveFiles, useArchiveFolders } from '../utility/metadataLoaders';
|
||||
@@ -40,7 +41,7 @@
|
||||
$: files = useArchiveFiles({ folder });
|
||||
|
||||
const handleRefreshFiles = () => {
|
||||
axiosInstance().post('archive/refresh-files', { folder });
|
||||
apiCall('archive/refresh-files', { folder });
|
||||
};
|
||||
|
||||
function handleNewDataSheet() {
|
||||
@@ -49,7 +50,7 @@
|
||||
label: 'New file name',
|
||||
header: 'Create new data sheet',
|
||||
onConfirm: async file => {
|
||||
await axiosInstance().post('archive/save-free-table', {
|
||||
await apiCall('archive/save-free-table', {
|
||||
folder: $currentArchive,
|
||||
file,
|
||||
data: createFreeTableModel(),
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
import SearchBoxWrapper from '../elements/SearchBoxWrapper.svelte';
|
||||
import SearchInput from '../elements/SearchInput.svelte';
|
||||
import FontIcon from '../icons/FontIcon.svelte';
|
||||
import { apiCall } from '../utility/api';
|
||||
import axiosInstance from '../utility/axiosInstance';
|
||||
import { useArchiveFolders } from '../utility/metadataLoaders';
|
||||
import WidgetsInnerContainer from './WidgetsInnerContainer.svelte';
|
||||
@@ -20,7 +21,7 @@
|
||||
$: folders = useArchiveFolders();
|
||||
|
||||
const handleRefreshFolders = () => {
|
||||
axiosInstance().post('archive/refresh-folders', {});
|
||||
apiCall('archive/refresh-folders');
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
import { useConnectionColorFactory } from '../utility/useConnectionColor';
|
||||
import FontIcon from '../icons/FontIcon.svelte';
|
||||
import CloseSearchButton from '../elements/CloseSearchButton.svelte';
|
||||
import { apiCall } from '../utility/api';
|
||||
|
||||
const connections = useConnectionList();
|
||||
const serverStatus = useServerStatus();
|
||||
@@ -29,7 +30,7 @@
|
||||
|
||||
const handleRefreshConnections = () => {
|
||||
for (const conid of $openedConnections) {
|
||||
axiosInstance().post('server-connections/refresh', { conid });
|
||||
apiCall('server-connections/refresh', { conid });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
import axiosInstance from '../utility/axiosInstance';
|
||||
import openNewTab from '../utility/openNewTab';
|
||||
import CloseSearchButton from '../elements/CloseSearchButton.svelte';
|
||||
import { apiCall } from '../utility/api';
|
||||
|
||||
let filter = '';
|
||||
let search = '';
|
||||
@@ -18,15 +19,8 @@
|
||||
let historyItems = [];
|
||||
|
||||
async function reloadItems() {
|
||||
const resp = await axiosInstance().request({
|
||||
method: 'get',
|
||||
url: 'query-history/read',
|
||||
params: {
|
||||
filter: search,
|
||||
limit: 100,
|
||||
},
|
||||
});
|
||||
historyItems = resp.data;
|
||||
const resp = await apiCall('query-history/read', { filter: search, limit: 100 });
|
||||
historyItems = resp;
|
||||
}
|
||||
|
||||
$: {
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
import { extensions } from '../stores';
|
||||
import newQuery from '../query/newQuery';
|
||||
import runCommand from '../commands/runCommand';
|
||||
import { apiCall } from '../utility/api';
|
||||
|
||||
export let conid;
|
||||
export let database;
|
||||
@@ -62,7 +63,7 @@
|
||||
// $: objectList = generateObjectList(generateIndex);
|
||||
|
||||
const handleRefreshDatabase = () => {
|
||||
axiosInstance().post('database-connections/refresh', { conid, database });
|
||||
apiCall('database-connections/refresh', { conid, database });
|
||||
};
|
||||
|
||||
function createAddMenu() {
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
import axiosInstance from '../utility/axiosInstance';
|
||||
import { findCommand } from '../commands/runCommand';
|
||||
import { useConnectionColor } from '../utility/useConnectionColor';
|
||||
import { apiCall } from '../utility/api';
|
||||
|
||||
$: databaseName = $currentDatabase && $currentDatabase.name;
|
||||
$: connection = $currentDatabase && $currentDatabase.connection;
|
||||
@@ -64,7 +65,7 @@
|
||||
|
||||
async function handleSyncModel() {
|
||||
if (connection && databaseName) {
|
||||
await axiosInstance().post('database-connections/sync-model', { conid: connection._id, database: databaseName });
|
||||
await apiCall('database-connections/sync-model', { conid: connection._id, database: databaseName });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user