axiosInstance replaced with apiCall

This commit is contained in:
Jan Prochazka
2021-12-22 10:16:44 +01:00
parent 148af24b2c
commit f9c54cdce2
55 changed files with 257 additions and 328 deletions

View File

@@ -47,13 +47,11 @@
header: 'Create collection',
onConfirm: async newCollection => {
const dbid = { conid: connection._id, database: name };
await axiosInstance().request({
url: 'database-connections/run-script',
method: 'post',
params: dbid,
data: { sql: `db.createCollection('${newCollection}')` },
await apiCall('database-connections/run-script', {
...dbid,
sql: `db.createCollection('${newCollection}')`,
});
axiosInstance().post('database-connections/sync-model', dbid);
await apiCall('database-connections/sync-model', dbid);
},
});
};
@@ -90,19 +88,19 @@
const handleDisconnect = () => {
const electron = getElectron();
if (electron) {
axiosInstance().post('database-connections/disconnect', { conid: connection._id, database: name });
apiCall('database-connections/disconnect', { conid: connection._id, database: name });
}
currentDatabase.set(null);
};
const handleExportModel = async () => {
const resp = await axiosInstance().post('database-connections/export-model', {
const resp = await apiCall('database-connections/export-model', {
conid: connection._id,
database: name,
});
currentArchive.set(resp.data.archiveFolder);
currentArchive.set(resp.archiveFolder);
selectedWidget.set('archive');
showSnackbarSuccess(`Saved to archive ${resp.data.archiveFolder}`);
showSnackbarSuccess(`Saved to archive ${resp.archiveFolder}`);
};
const handleCompareWithCurrentDb = () => {
@@ -182,6 +180,7 @@
import InputTextModal from '../modals/InputTextModal.svelte';
import { getDatabaseInfo } from '../utility/metadataLoaders';
import { openJsonDocument } from '../tabs/JsonTab.svelte';
import { apiCall } from '../utility/api';
export let data;
export let passProps;