feat: introducing Auth for admin dashboard (HBE-138) (#32)

This commit is contained in:
Anwarul Islam
2023-03-09 11:29:40 +06:00
committed by GitHub
parent 80898407c3
commit 9b76d62753
29 changed files with 1846 additions and 765 deletions

View File

@@ -1,33 +1,16 @@
import { createApp } from 'vue';
import urql, { createClient } from '@urql/vue';
import App from './App.vue';
import Toasted from '@hoppscotch/vue-toasted';
import type { ToastOptions } from '@hoppscotch/vue-toasted';
// STYLES
import 'virtual:windi.css';
import '@hoppscotch/vue-toasted/style.css';
import '@hoppscotch/ui/style.css';
import '../assets/scss/themes.scss';
import '../assets/scss/styles.scss';
// END STYLES
import {
createRouter,
createWebHashHistory,
createWebHistory,
} from 'vue-router';
import { setupLayouts } from 'virtual:generated-layouts';
import generatedRoutes from 'virtual:generated-pages';
import { plugin as HoppUIPlugin, HoppUIPluginOptions } from '@hoppscotch/ui';
const options: HoppUIPluginOptions = {
/* Define options here */
};
const routes = setupLayouts(generatedRoutes);
import { HOPP_MODULES } from './modules';
import { auth } from './helpers/auth';
const app = createApp(App).use(
urql,
@@ -41,21 +24,10 @@ const app = createApp(App).use(
})
);
// We are using a fork of Vue Toasted (github.com/clayzar/vue-toasted) which is a bit of
// an untrusted fork, we will either want to make our own fork or move to a more stable one
// The original Vue Toasted doesn't support Vue 3 and the OP has been irresponsive.
app.use(Toasted, <ToastOptions>{
position: 'bottom-center',
duration: 3000,
keepOnHover: true,
});
// Initialize auth
await auth.performAuthInit();
app.use(HoppUIPlugin, options);
app.use(
createRouter({
history: createWebHistory(),
routes,
})
);
// Initialize modules
HOPP_MODULES.forEach((mod) => mod.onVueAppInit?.(app));
app.mount('#app');