Bug 32030: Use fetch.js, improve messages handling, remove top level modules
[koha.git] / koha-tmpl / intranet-tmpl / prog / js / vue / main-erm.ts
1 import { createApp } from "vue";
2 import { createWebHistory, createRouter } from "vue-router";
3 import { createPinia } from "pinia";
4
5 import { library } from "@fortawesome/fontawesome-svg-core";
6 import { faPlus, faPencil, faTrash } from "@fortawesome/free-solid-svg-icons";
7 import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
8
9 library.add(faPlus, faPencil, faTrash);
10
11 import App from "./components/ERM/ERMMain.vue";
12
13 import { routes } from "./routes";
14
15 const router = createRouter({ history: createWebHistory(), routes });
16
17 import { useMainStore } from "./stores/main";
18 createApp(App)
19     .use(createPinia())
20     .use(router)
21     .component("font-awesome-icon", FontAwesomeIcon)
22     .mount("#erm");
23
24 const mainStore = useMainStore();
25 const { removeMessages } = mainStore;
26 router.beforeEach((to, from) => {
27     removeMessages(); // This will actually flag the messages as displayed already
28 });