mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 13:06:01 +00:00
axiosInstance replaced with apiCall
This commit is contained in:
@@ -174,6 +174,7 @@
|
||||
import FontIcon from '../icons/FontIcon.svelte';
|
||||
import DictionaryLookupModal from '../modals/DictionaryLookupModal.svelte';
|
||||
import { showModal } from '../modals/modalTools';
|
||||
import { apiCall } from '../utility/api';
|
||||
|
||||
import axiosInstance from '../utility/axiosInstance';
|
||||
import { copyTextToClipboard, extractRowCopiedValue } from '../utility/clipboard';
|
||||
@@ -260,7 +261,7 @@
|
||||
}
|
||||
|
||||
export async function reconnect() {
|
||||
await axiosInstance().post('database-connections/refresh', { conid, database });
|
||||
await apiCall('database-connections/refresh', { conid, database });
|
||||
formDisplay.reload();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
<script lang="ts" context="module">
|
||||
import { apiCall } from '../utility/api';
|
||||
|
||||
async function loadRow(props, sql) {
|
||||
const { conid, database } = props;
|
||||
|
||||
if (!sql) return null;
|
||||
|
||||
const response = await axiosInstance().request({
|
||||
url: 'database-connections/query-data',
|
||||
method: 'post',
|
||||
params: {
|
||||
conid,
|
||||
database,
|
||||
},
|
||||
data: { sql },
|
||||
const response = await apiCall('database-connections/query-data', {
|
||||
conid,
|
||||
database,
|
||||
sql,
|
||||
});
|
||||
|
||||
if (response.data.errorMessage) return response.data;
|
||||
return response.data.rows[0];
|
||||
if (response.errorMessage) return response;
|
||||
return response.rows[0];
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -122,42 +120,6 @@
|
||||
$: former = new ChangeSetFormer(rowData, changeSetState, dispatchChangeSet, formDisplay);
|
||||
|
||||
$: if (onReferenceSourceChanged && rowData) onReferenceSourceChanged([rowData], loadedTime);
|
||||
|
||||
// async function handleConfirmSql(sql) {
|
||||
// const resp = await axiosInstance().request({
|
||||
// url: 'database-connections/query-data',
|
||||
// method: 'post',
|
||||
// params: {
|
||||
// conid,
|
||||
// database,
|
||||
// },
|
||||
// data: { sql },
|
||||
// });
|
||||
// const { errorMessage } = resp.data || {};
|
||||
// if (errorMessage) {
|
||||
// showModal(ErrorMessageModal, { title: 'Error when saving', message: errorMessage });
|
||||
// } else {
|
||||
// dispatchChangeSet({ type: 'reset', value: createChangeSet() });
|
||||
// formDisplay.reload();
|
||||
// }
|
||||
// }
|
||||
|
||||
// function handleSave() {
|
||||
// const script = changeSetToSql(changeSetState && changeSetState.value, formDisplay.dbinfo);
|
||||
// const sql = scriptToSql(formDisplay.driver, script);
|
||||
// showModal(ConfirmSqlModal, {
|
||||
// sql,
|
||||
// onConfirm: () => handleConfirmSql(sql),
|
||||
// engine: formDisplay.engine,
|
||||
// });
|
||||
// }
|
||||
</script>
|
||||
|
||||
<FormView
|
||||
{...$$props}
|
||||
{former}
|
||||
isLoading={isLoadingData}
|
||||
{allRowCount}
|
||||
{rowCountBefore}
|
||||
onNavigate={handleNavigate}
|
||||
/>
|
||||
<FormView {...$$props} {former} isLoading={isLoadingData} {allRowCount} {rowCountBefore} onNavigate={handleNavigate} />
|
||||
|
||||
Reference in New Issue
Block a user