|
Line 0
Link Here
|
|
|
1 |
import { createApp } from "vue"; |
| 2 |
import { createPinia } from "pinia"; |
| 3 |
import { createWebHistory, createRouter } from "vue-router"; |
| 4 |
|
| 5 |
import { library } from "@fortawesome/fontawesome-svg-core"; |
| 6 |
import { |
| 7 |
faPlus, |
| 8 |
faMinus, |
| 9 |
faPencil, |
| 10 |
faTrash, |
| 11 |
faSpinner, |
| 12 |
} from "@fortawesome/free-solid-svg-icons"; |
| 13 |
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; |
| 14 |
import vSelect from "vue-select"; |
| 15 |
import { useNavigationStore } from "../../stores/navigation"; |
| 16 |
import { useMainStore } from "../../stores/main"; |
| 17 |
import { useCircRulesStore } from "../../stores/circulation-rules"; |
| 18 |
import routesDef from "../../routes/admin/circulation_triggers"; |
| 19 |
|
| 20 |
library.add(faPlus, faMinus, faPencil, faTrash, faSpinner); |
| 21 |
|
| 22 |
const pinia = createPinia(); |
| 23 |
const navigationStore = useNavigationStore(pinia); |
| 24 |
const mainStore = useMainStore(pinia); |
| 25 |
const circRulesStore = useCircRulesStore(pinia); |
| 26 |
const { removeMessages } = mainStore; |
| 27 |
const { setRoutes } = navigationStore; |
| 28 |
const routes = setRoutes(routesDef); |
| 29 |
|
| 30 |
const router = createRouter({ |
| 31 |
history: createWebHistory(), |
| 32 |
linkExactActiveClass: "current", |
| 33 |
routes, |
| 34 |
}); |
| 35 |
|
| 36 |
import App from "../../components/Admin/CirculationTriggers/Main.vue"; |
| 37 |
import i18n from "../../i18n"; |
| 38 |
|
| 39 |
const app = createApp(App); |
| 40 |
|
| 41 |
const rootComponent = app |
| 42 |
.use(i18n) |
| 43 |
.use(pinia) |
| 44 |
.use(router) |
| 45 |
.component("font-awesome-icon", FontAwesomeIcon) |
| 46 |
.component("v-select", vSelect); |
| 47 |
|
| 48 |
app.config.unwrapInjectedRef = true; |
| 49 |
app.provide("mainStore", mainStore); |
| 50 |
app.provide("navigationStore", navigationStore); |
| 51 |
app.provide("circRulesStore", circRulesStore); |
| 52 |
app.mount("#__app"); |
| 53 |
|
| 54 |
router.beforeEach(to => { |
| 55 |
navigationStore.$patch({ current: to.matched, params: to.params || {} }); |
| 56 |
removeMessages(); // This will actually flag the messages as displayed already |
| 57 |
}); |