dbgate/packages/web/src/main.ts

44 lines
976 B
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';
2021-03-20 09:08:27 +00:00
2022-11-17 19:09:27 +00:00
const isOauthCallback = handleOauthCallback();
2022-11-25 12:36:18 +00:00
const params = new URLSearchParams(location.search);
const page = params.get('page');
2021-03-20 09:08:27 +00:00
localStorageGarbageCollector();
2022-11-25 12:36:18 +00:00
function createApp() {
if (isOauthCallback) {
return null;
}
switch (page) {
case 'login':
return new LoginPage({
target: document.body,
props: {},
});
case 'not-logged':
return new NotLoggedPage({
target: document.body,
props: {},
});
}
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;