mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 11:06:02 +00:00
axiosInstance replaced with apiCall
This commit is contained in:
@@ -154,6 +154,7 @@
|
||||
import SqlEditor from '../query/SqlEditor.svelte';
|
||||
import useEditorData from '../query/useEditorData';
|
||||
import { extensions } from '../stores';
|
||||
import { apiCall } from '../utility/api';
|
||||
import axiosInstance from '../utility/axiosInstance';
|
||||
import { changeTab } from '../utility/common';
|
||||
import contextMenu, { getContextMenu, registerMenu } from '../utility/contextMenu';
|
||||
@@ -228,7 +229,7 @@
|
||||
|
||||
export async function showReport() {
|
||||
saveFileToDisk(async filePath => {
|
||||
await axiosInstance().post('database-connections/generate-db-diff-report', {
|
||||
await apiCall('database-connections/generate-db-diff-report', {
|
||||
filePath,
|
||||
sourceConid: $values?.sourceConid,
|
||||
sourceDatabase: $values?.sourceDatabase,
|
||||
@@ -261,11 +262,11 @@
|
||||
}
|
||||
|
||||
export function refreshModels() {
|
||||
axiosInstance().post('database-connections/sync-model', {
|
||||
apiCall('database-connections/sync-model', {
|
||||
conid: $values?.targetConid,
|
||||
database: $values?.targetDatabase,
|
||||
});
|
||||
axiosInstance().post('database-connections/sync-model', {
|
||||
apiCall('database-connections/sync-model', {
|
||||
conid: $values?.sourceConid,
|
||||
database: $values?.sourceDatabase,
|
||||
});
|
||||
@@ -275,18 +276,13 @@
|
||||
const conid = $values?.targetConid;
|
||||
const database = $values?.targetDatabase;
|
||||
|
||||
const resp = await axiosInstance().request({
|
||||
url: 'database-connections/run-script',
|
||||
method: 'post',
|
||||
params: { conid, database },
|
||||
data: { sql },
|
||||
});
|
||||
const resp = await apiCall('database-connections/run-script', { conid, database, sql });
|
||||
const { errorMessage } = resp.data || {};
|
||||
if (errorMessage) {
|
||||
showModal(ErrorMessageModal, { title: 'Error when saving', message: errorMessage });
|
||||
} else {
|
||||
$values = _.omitBy($values, (v, k) => k.startsWith('isChecked_'));
|
||||
await axiosInstance().post('database-connections/sync-model', { conid, database });
|
||||
await apiCall('database-connections/sync-model', { conid, database });
|
||||
showSnackbarSuccess('Saved to database');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user