mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 13:53:59 +00:00
start app after load plugins
This commit is contained in:
@@ -13,27 +13,31 @@
|
|||||||
import ErrorHandler from './utility/ErrorHandler.svelte';
|
import ErrorHandler from './utility/ErrorHandler.svelte';
|
||||||
import OpenTabsOnStartup from './utility/OpenTabsOnStartup.svelte';
|
import OpenTabsOnStartup from './utility/OpenTabsOnStartup.svelte';
|
||||||
|
|
||||||
let loaded = false;
|
let loadedApi = false;
|
||||||
|
|
||||||
async function loadSettings() {
|
async function loadApi() {
|
||||||
try {
|
try {
|
||||||
const settings = await axiosInstance.get('config/get-settings');
|
const settings = await axiosInstance.get('config/get-settings');
|
||||||
const connections = await axiosInstance.get('connections/list');
|
const connections = await axiosInstance.get('connections/list');
|
||||||
const config = await axiosInstance.get('config/get');
|
const config = await axiosInstance.get('config/get');
|
||||||
loaded = settings?.data && connections?.data && config?.data;
|
loadedApi = settings?.data && connections?.data && config?.data;
|
||||||
if (loaded) {
|
if (!loadedApi) {
|
||||||
setAppLoaded();
|
|
||||||
} else {
|
|
||||||
console.log('API not initialized correctly, trying again in 1s');
|
console.log('API not initialized correctly, trying again in 1s');
|
||||||
setTimeout(loadSettings, 1000);
|
setTimeout(loadApi, 1000);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Error calling API, trying again in 1s');
|
console.log('Error calling API, trying again in 1s');
|
||||||
setTimeout(loadSettings, 1000);
|
setTimeout(loadApi, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(loadSettings);
|
onMount(loadApi);
|
||||||
|
|
||||||
|
$: {
|
||||||
|
if (loadedApi && $loadingPluginStore?.loaded) {
|
||||||
|
setAppLoaded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -41,7 +45,7 @@
|
|||||||
<ErrorHandler />
|
<ErrorHandler />
|
||||||
<CommandListener />
|
<CommandListener />
|
||||||
|
|
||||||
{#if loaded}
|
{#if loadedApi}
|
||||||
<PluginsProvider />
|
<PluginsProvider />
|
||||||
{#if $loadingPluginStore?.loaded}
|
{#if $loadingPluginStore?.loaded}
|
||||||
<OpenTabsOnStartup />
|
<OpenTabsOnStartup />
|
||||||
|
|||||||
Reference in New Issue
Block a user