mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 02:16:02 +00:00
axiosInstance replaced with apiCall
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
<script lang="ts">
|
||||
import { onMount, afterUpdate, onDestroy } from 'svelte';
|
||||
import registerCommand from '../commands/registerCommand';
|
||||
import { apiCall } from '../utility/api';
|
||||
import axiosInstance from '../utility/axiosInstance';
|
||||
|
||||
import contextMenu, { getContextMenu, registerMenu } from '../utility/contextMenu';
|
||||
@@ -61,7 +62,7 @@
|
||||
|
||||
export async function exportChart() {
|
||||
saveFileToDisk(async filePath => {
|
||||
await axiosInstance().post('files/export-chart', {
|
||||
await apiCall('files/export-chart', {
|
||||
title,
|
||||
filePath,
|
||||
config: {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { dumpSqlSelect, Select } from 'dbgate-sqltree';
|
||||
import { EngineDriver } from 'dbgate-types';
|
||||
import axiosInstance from '../utility/axiosInstance';
|
||||
import _ from 'lodash';
|
||||
import { apiCall } from '../utility/api';
|
||||
|
||||
export async function loadChartStructure(driver: EngineDriver, conid, database, sql) {
|
||||
const select: Select = {
|
||||
@@ -16,9 +17,9 @@ export async function loadChartStructure(driver: EngineDriver, conid, database,
|
||||
|
||||
const dmp = driver.createDumper();
|
||||
dumpSqlSelect(dmp, select);
|
||||
const resp = await axiosInstance().post('database-connections/query-data', { conid, database, sql: dmp.s });
|
||||
if (resp.data.errorMessage) throw new Error(resp.data.errorMessage);
|
||||
return resp.data.columns.map(x => x.columnName);
|
||||
const resp = await apiCall('database-connections/query-data', { conid, database, sql: dmp.s });
|
||||
if (resp.errorMessage) throw new Error(resp.errorMessage);
|
||||
return resp.columns.map(x => x.columnName);
|
||||
}
|
||||
|
||||
export async function loadChartData(driver: EngineDriver, conid, database, sql, config) {
|
||||
@@ -74,8 +75,8 @@ export async function loadChartData(driver: EngineDriver, conid, database, sql,
|
||||
|
||||
const dmp = driver.createDumper();
|
||||
dumpSqlSelect(dmp, select);
|
||||
const resp = await axiosInstance().post('database-connections/query-data', { conid, database, sql: dmp.s });
|
||||
let { rows, columns, errorMessage } = resp.data;
|
||||
const resp = await apiCall('database-connections/query-data', { conid, database, sql: dmp.s });
|
||||
let { rows, columns, errorMessage } = resp;
|
||||
if (errorMessage) {
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user