diff --git a/components.d.ts b/components.d.ts index 94cb260..9d4ba8d 100644 --- a/components.d.ts +++ b/components.d.ts @@ -18,6 +18,7 @@ declare module 'vue' { BellFilled: typeof import('./src/components/icons/BellFilled.vue')['default'] Button: typeof import('primevue/button')['default'] Checkbox: typeof import('primevue/checkbox')['default'] + CheckIcon: typeof import('./src/components/icons/CheckIcon.vue')['default'] DashboardLayout: typeof import('./src/components/DashboardLayout.vue')['default'] Home: typeof import('./src/components/icons/Home.vue')['default'] HomeFilled: typeof import('./src/components/icons/HomeFilled.vue')['default'] @@ -42,6 +43,7 @@ declare global { const BellFilled: typeof import('./src/components/icons/BellFilled.vue')['default'] const Button: typeof import('primevue/button')['default'] const Checkbox: typeof import('primevue/checkbox')['default'] + const CheckIcon: typeof import('./src/components/icons/CheckIcon.vue')['default'] const DashboardLayout: typeof import('./src/components/DashboardLayout.vue')['default'] const Home: typeof import('./src/components/icons/Home.vue')['default'] const HomeFilled: typeof import('./src/components/icons/HomeFilled.vue')['default'] diff --git a/src/api/rpc/auth.ts b/src/api/rpc/auth.ts index f1d8612..900fe0c 100644 --- a/src/api/rpc/auth.ts +++ b/src/api/rpc/auth.ts @@ -164,7 +164,6 @@ const login = async (username: string, password: string) => { }; async function checkAuth() { - console.log("Check auth called"); const context = getContext(); const token = getCookie(context, 'auth_token'); @@ -183,7 +182,6 @@ async function checkAuth() { if (!userRecord) { return { authenticated: false, user: null }; } - // console.log("Check auth called 2", userRecord); return { authenticated: true, diff --git a/src/components/RootLayout.vue b/src/components/RootLayout.vue index 01a0b42..621cb5a 100644 --- a/src/components/RootLayout.vue +++ b/src/components/RootLayout.vue @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/src/components/icons/CheckIcon.vue b/src/components/icons/CheckIcon.vue new file mode 100644 index 0000000..8da9b73 --- /dev/null +++ b/src/components/icons/CheckIcon.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index 78987a3..261cfe3 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -33,12 +33,12 @@ app.get("*", async (c) => { const url = new URL(c.req.url); const { app, router, head, pinia, bodyClass } = createApp(); app.provide("honoContext", c); + const auth = useAuthStore(); + auth.$reset(); + auth.initialized = false; + await auth.init(); await router.push(url.pathname); - await router.isReady().then(() => { - const auth = useAuthStore(); - auth.initialized = false; - auth.init(); - }); + await router.isReady(); let usedStyles = new Set(defaultNames); Base.setLoadedStyleName = async (name: string) => usedStyles.add(name) return streamText(c, async (stream) => { diff --git a/src/main.ts b/src/main.ts index f2c117e..eec33c8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,12 +4,13 @@ import { createSSRApp } from 'vue'; import { RouterView } from 'vue-router'; import { withErrorBoundary } from './lib/hoc/withErrorBoundary'; import { vueSWR } from './lib/swr/use-swrv'; -import router from './routes'; +import createAppRouter from './routes'; import PrimeVue from 'primevue/config'; import Aura from '@primeuix/themes/aura'; import { createPinia } from "pinia"; import { useAuthStore } from './stores/auth'; - +import ToastService from 'primevue/toastservice'; +import Tooltip from 'primevue/tooltip'; const bodyClass = ":uno: font-sans bg-[#f9fafd] text-gray-800 antialiased flex flex-col min-h-screen" export function createApp() { const pinia = createPinia(); @@ -30,22 +31,22 @@ export function createApp() { } } }); + app.use(ToastService); app.directive('no-hydrate', { created(el) { el.__v_skip = true; } }); - app.use(vueSWR({revalidateOnFocus: false})); - app.use(router); - app.use(pinia); - - // Initialize auth store on client side + app.directive("tooltip", Tooltip) if (!import.meta.env.SSR) { - router.isReady().then(() => { - const auth = useAuthStore(); - auth.init(); - }); + if ((window as any).__PINIA_STATE__ ) { + pinia.state.value = (window as any).__PINIA_STATE__; + } } + app.use(pinia); + app.use(vueSWR({revalidateOnFocus: false})); + const router = createAppRouter(); + app.use(router); return { app, router, head, pinia, bodyClass }; } \ No newline at end of file diff --git a/src/routes/auth/layout.vue b/src/routes/auth/layout.vue index e506efe..ff2818a 100644 --- a/src/routes/auth/layout.vue +++ b/src/routes/auth/layout.vue @@ -1,15 +1,18 @@