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

@@ -58,6 +58,7 @@
import { changeTab } from '../utility/common';
import StatusBarTabItem from '../widgets/StatusBarTabItem.svelte';
import openNewTab from '../utility/openNewTab';
import { apiCall } from '../utility/api';
export let tabid;
export let conid;
@@ -130,16 +131,8 @@
}
async function handleConfirmSql(sql, createTableName) {
const resp = await axiosInstance().request({
url: 'database-connections/run-script',
method: 'post',
params: {
conid,
database,
},
data: { sql },
});
const { errorMessage } = resp.data || {};
const resp = await apiCall('database-connections/run-script', { conid, database, sql });
const { errorMessage } = resp || {};
if (errorMessage) {
showModal(ErrorMessageModal, { title: 'Error when saving', message: errorMessage });
} else {
@@ -154,14 +147,14 @@
}));
}
await axiosInstance().post('database-connections/sync-model', { conid, database });
await apiCall('database-connections/sync-model', { conid, database });
showSnackbarSuccess('Saved to database');
clearEditorData();
}
}
export async function reset() {
await axiosInstance().post('database-connections/sync-model', { conid, database });
await apiCall('database-connections/sync-model', { conid, database });
clearEditorData();
}