diff --git a/aleksis/core/assets/app.js b/aleksis/core/assets/app.js index cf54e309b675ad30e51dad468b2daf24bf7f2d5a..4efec02db54568c43af3686cedc004ef72eb7088 100644 --- a/aleksis/core/assets/app.js +++ b/aleksis/core/assets/app.js @@ -70,8 +70,14 @@ export const typeDefs = gql` read: Boolean! } + type globalState { + contentLoading: Boolean! + browserTitle: String + } + type Mutation { checkSnackbarItem(id: ID!): Boolean + setLoading(state: Boolean!): Boolean } `; @@ -86,6 +92,9 @@ const resolvers = { cache.writeQuery({query: gqlSnackbarItems, data}); return currentItem.read; }, + setLoading: (_, {state}, {}) => { + return true; + } }, }; @@ -180,6 +189,17 @@ const app = new Vue({ i18n, }); +router.beforeEach((to, from, next) => { + app.contentLoading = true; + next(); +}) + +router.afterEach((to, from) => { + Vue.nextTick( () => { + app.contentLoading = false; + }); +}) + window.app = app; window.router = router; window.i18n = i18n;