dbgate/packages/web/src/main.ts

69 lines
1.5 KiB
TypeScript
Raw Normal View History

2021-02-17 17:46:27 +00:00
import App from './App.svelte';
2021-02-20 20:35:24 +00:00
import './utility/connectionsPinger';
2021-03-01 17:37:15 +00:00
import './utility/changeCurrentDbByTab';
2021-02-25 17:05:44 +00:00
import './commands/stdCommands';
2021-03-20 09:08:27 +00:00
import localStorageGarbageCollector from './utility/localStorageGarbageCollector';
2022-11-17 18:55:01 +00:00
import { handleOauthCallback } from './clientAuth';
2022-11-25 12:36:18 +00:00
import LoginPage from './LoginPage.svelte';
import NotLoggedPage from './NotLoggedPage.svelte';
2024-07-31 13:36:55 +00:00
import ErrorPage from './ErrorPage.svelte';
2024-08-13 14:29:07 +00:00
import EnterLicensePage from './EnterLicensePage.svelte';
2021-03-20 09:08:27 +00:00
2024-08-06 12:59:09 +00:00
const isOauthCallback = handleOauthCallback();
2021-03-20 09:08:27 +00:00
localStorageGarbageCollector();
2022-11-25 12:36:18 +00:00
function createApp() {
if (isOauthCallback) {
return null;
}
2024-09-03 10:57:52 +00:00
switch (window['dbgate_page']) {
2022-11-25 12:36:18 +00:00
case 'login':
return new LoginPage({
2024-07-31 13:36:55 +00:00
target: document.body,
props: {
isAdminPage: false,
},
});
case 'error':
return new ErrorPage({
2022-11-25 12:36:18 +00:00
target: document.body,
props: {},
});
2024-08-13 14:29:07 +00:00
case 'license':
return new EnterLicensePage({
target: document.body,
props: {},
});
2024-07-26 14:30:01 +00:00
case 'admin-login':
return new LoginPage({
target: document.body,
props: {
isAdminPage: true,
},
});
2022-11-25 12:36:18 +00:00
case 'not-logged':
return new NotLoggedPage({
target: document.body,
props: {},
});
2024-07-26 14:30:01 +00:00
case 'admin':
return new App({
target: document.body,
props: {
isAdminPage: true,
},
});
2022-11-25 12:36:18 +00:00
}
return new App({
target: document.body,
props: {},
});
}
2021-02-17 17:46:27 +00:00
2022-11-25 12:36:18 +00:00
const app = createApp();
2022-05-17 19:25:00 +00:00
2021-02-17 18:26:48 +00:00
export default app;