import { createSSRApp } from 'vue';
import '@vingogo/uni-ui/lib/style.css';
import App from './App.vue';
import pinia from './state/index';
import router from './router';
import { useUserStore } from '@/state/modules/user';
import { registerClearSessionHandler } from '@/utils/session';
import './style/index.css';

export function createApp() {
    const app = createSSRApp(App);
    app.use(pinia);
    registerClearSessionHandler(() => {
        void useUserStore().clear();
    });
    app.use(router);
    return {
        app,
    };
}
