25 行
607 B
TypeScript
25 行
607 B
TypeScript
import {createApp} from "vue";
|
|
import {createPinia} from "pinia";
|
|
import ElementPlus from "element-plus";
|
|
import "element-plus/dist/index.css";
|
|
import App from "./App.vue";
|
|
import router from "./router";
|
|
import piniaPersist from "pinia-plugin-persist";
|
|
import { useTenantStore } from "./store/useTenantStore";
|
|
|
|
const app = createApp(App);
|
|
const pinia = createPinia();
|
|
pinia.use(piniaPersist);
|
|
|
|
|
|
router.beforeEach((to) => {
|
|
const tenant = useTenantStore(pinia);
|
|
|
|
if (to.meta.requiresAuth && !tenant.isLogin) return "/login";
|
|
});
|
|
|
|
app.use(ElementPlus);
|
|
app.use(pinia);
|
|
app.use(router);
|
|
app.mount("#app");
|