Skip to content
Snippets Groups Projects
Verified Commit 723a9d51 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

[Refactor] Get rid of window.app

parent c5c506ca
No related branches found
No related tags found
1 merge request!1123Resolve "Finalise Vuetify app as SPA"
Pipeline #107995 failed
......@@ -2,8 +2,6 @@
* Main entrypoint of AlekSIS0-ore.
*
* This script sets up all necessary Vue plugins and defines the Vue app.
* For convenience, the Vue app instance will be made globally available
* as window.app.
*/
import Vue from "vue";
......@@ -56,5 +54,3 @@ const app = new Vue({
// Late setup for some plugins handed off to out ALeksisVue plugin
app.$loadAppMessages();
app.$setupNavigationGuards();
window.app = app;
......@@ -102,21 +102,23 @@ AleksisVue.install = function (Vue, options) {
* Add navigation guards to account for global loading state and page titles.
*/
Vue.prototype.$setupNavigationGuards = function () {
const vm = this;
// eslint-disable-next-line no-unused-vars
this.$router.afterEach((to, from, next) => {
console.debug("Setting new page title due to route change");
window.app.$setPageTitle(null, to);
vm.$setPageTitle(null, to);
});
// eslint-disable-next-line no-unused-vars
this.$router.beforeEach((to, from, next) => {
window.app.contentLoading = true;
vm.contentLoading = true;
next();
});
// eslint-disable-next-line no-unused-vars
this.$router.afterEach((to, from) => {
window.app.contentLoading = false;
vm.contentLoading = false;
});
};
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment