vbv/client/src/main.ts

56 lines
1.3 KiB
TypeScript

import * as Sentry from "@sentry/vue";
import * as log from "loglevel";
import { createPinia } from "pinia";
import { createApp, markRaw } from "vue";
import urql from "@urql/vue";
import App from "./App.vue";
import { loadLocaleMessages, setupI18n } from "./i18n";
import router from "./router";
import type { Router } from "vue-router";
import "../tailwind.css";
declare module "pinia" {
export interface PiniaCustomProperties {
router: Router;
}
}
if (window.location.href.indexOf("localhost") >= 0) {
log.setLevel("trace");
} else {
log.setLevel("warn");
}
const i18n = setupI18n();
const app = createApp(App);
Sentry.init({
app,
environment: import.meta.env.VITE_SENTRY_ENV,
dsn: "https://2df6096a4fd94bd6b4802124d10e4b8d@o8544.ingest.sentry.io/4504157846372352",
tracesSampleRate: 0.0,
enabled:
import.meta.env.VITE_SENTRY_ENV == "production" ||
import.meta.env.VITE_SENTRY_ENV == "stage",
});
// todo: define lang setup
loadLocaleMessages(i18n, "de").then(() => {
app.use(router);
const pinia = createPinia();
pinia.use(({ store }) => {
store.router = markRaw(router);
});
app.use(pinia);
app.use(i18n);
app.use(urql, {
url: import.meta.env.VITE_GRAPHQL_URL || "/server/graphql",
});
app.mount("#app");
});