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

@@ -7,6 +7,7 @@ import { currentDatabase, extensions } from '../stores';
import { getUploadListener } from './uploadFiles';
import axiosInstance from '../utility/axiosInstance';
import { getDatabaseFileLabel } from './getConnectionLabel';
import { apiCall } from './api';
export function canOpenByElectron(file, extensions) {
if (!file) return false;
@@ -21,7 +22,7 @@ export function canOpenByElectron(file, extensions) {
export async function openSqliteFile(filePath) {
const defaultDatabase = getDatabaseFileLabel(filePath);
const resp = await axiosInstance().post('connections/save', {
const resp = await apiCall('connections/save', {
_id: undefined,
databaseFile: filePath,
engine: 'sqlite@dbgate-plugin-sqlite',
@@ -29,7 +30,7 @@ export async function openSqliteFile(filePath) {
defaultDatabase,
});
currentDatabase.set({
connection: resp.data,
connection: resp,
name: getDatabaseFileLabel(filePath),
});
}