This commit is contained in:
2025-12-31 17:18:50 +07:00
parent 772e84c761
commit 16f64c5e4b
53 changed files with 4247 additions and 82 deletions

View File

@@ -5,13 +5,42 @@ import { RouterView } from 'vue-router';
import { withErrorBoundary } from './lib/hoc/withErrorBoundary';
import { vueSWR } from './lib/swr/use-swrv';
import router from './routes';
// import { appComponents } from './components'
import PrimeVue from 'primevue/config';
import Aura from '@primeuix/themes/aura';
import { createPinia } from "pinia";
import { useAuthStore } from './stores/auth';
const pinia = createPinia();
export function createApp() {
const app = createSSRApp(withErrorBoundary(RouterView));
const head = import.meta.env.SSR ? SSRHead() : CSRHead();
const app = createSSRApp(withErrorBoundary(RouterView))
const head = import.meta.env.SSR ? SSRHead() : CSRHead()
app.use(head)
app.use(vueSWR({revalidateOnFocus: false}))
app.use(router)
return { app, router, head }
app.use(head);
app.use(PrimeVue, {
theme: {
preset: Aura,
options: {
darkModeSelector: '.my-app-dark',
}
}
});
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
if (!import.meta.env.SSR) {
router.isReady().then(() => {
const auth = useAuthStore();
auth.init();
});
}
return { app, router, head };
}