From 6ad1df8310e4f69db287226669f76b6ba5c51219 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Thu, 2 Feb 2023 14:13:27 +0100 Subject: [PATCH] Remove vue3-logger --- client/src/main.js | 65 +++++----- client/src/pages/article.vue | 225 ++++++++++++++++++----------------- 2 files changed, 148 insertions(+), 142 deletions(-) diff --git a/client/src/main.js b/client/src/main.js index 800cf3a0..c75c5aff 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -1,9 +1,9 @@ import 'core-js/stable'; -import {createApp, configureCompat } from 'vue'; +import { createApp, configureCompat } from 'vue'; import VueVimeoPlayer from 'vue-vimeo-player'; import apolloClientFactory from './graphql/client'; import App from './App.vue'; -import {postLoginRedirectUrlKey, router} from './router'; +import { postLoginRedirectUrlKey, router } from './router'; import { store } from '@/store'; import VueScrollTo from 'vue-scrollto'; import autoGrow from '@/directives/auto-grow'; @@ -12,7 +12,6 @@ import ME_QUERY from '@/graphql/gql/queries/meQuery.gql'; import VueModal from '@/plugins/modal'; import VueRemoveEdges from '@/plugins/edges'; import VueMatomo from 'vue-matomo'; -import VueLogger from 'vuejs3-logger'; import { createApolloProvider } from '@vue/apollo-option'; import { joiningClass, loginRequired, unauthorizedAccess } from '@/router/guards'; import flavorPlugin from '@/plugins/flavor'; @@ -28,24 +27,16 @@ const apolloProvider = createApolloProvider({ }); configureCompat({ - MODE: 2 + MODE: 2, }); const app = createApp(App); app.use(store); -const isProduction = process.env.NODE_ENV === 'production'; - app.use(VueModal); app.use(VueRemoveEdges); app.use(VueVimeoPlayer); -app.use(VueLogger, { - isEnabled: true, - logLevel: isProduction ? 'error' : 'debug', - stringifyArguments: false, - showConsoleColors: true, -}); app.use(apolloProvider); app.use(router); @@ -57,7 +48,6 @@ app.use(router); app.directive('scroll-to', VueScrollTo); - app.use(flavorPlugin); if (process.env.MATOMO_HOST) { @@ -73,33 +63,36 @@ app.directive('auto-grow', autoGrow); /* guards */ - - function redirectUsersWithoutValidLicense() { - return privateApolloClient.query({ - query: ME_QUERY, - }).then(({data}) => data.me.expiryDate == null); + return privateApolloClient + .query({ + query: ME_QUERY, + }) + .then(({ data }) => data.me.expiryDate == null); } function redirectStudentsWithoutClass() { - return privateApolloClient.query({ - query: ME_QUERY, - }).then(({data}) => data.me.schoolClasses.length === 0 && !data.me.isTeacher); + return privateApolloClient + .query({ + query: ME_QUERY, + }) + .then(({ data }) => data.me.schoolClasses.length === 0 && !data.me.isTeacher); } function redirectUsersToOnboarding() { - return privateApolloClient.query({ - query: ME_QUERY, - }).then(({data}) => !data.me.onboardingVisited); + return privateApolloClient + .query({ + query: ME_QUERY, + }) + .then(({ data }) => !data.me.onboardingVisited); } function networkErrorCallback(statusCode) { if (statusCode === 402) { - router.push({name: 'licenseActivation'}); + router.push({ name: 'licenseActivation' }); } } - router.beforeEach(async (to, from, next) => { // todo: make logger work outside vue app // const logger = inject('vuejs3-logger'); @@ -111,7 +104,7 @@ router.beforeEach(async (to, from, next) => { next(false); return; } else { - next({name: 'hello'}); + next({ name: 'hello' }); return; } } @@ -130,23 +123,29 @@ router.beforeEach(async (to, from, next) => { return; } - if (to.name && to.name !== 'licenseActivation' && loginRequired(to) && await redirectUsersWithoutValidLicense()) { + if (to.name && to.name !== 'licenseActivation' && loginRequired(to) && (await redirectUsersWithoutValidLicense())) { // logger.$log.debug('redirecting to licenseActivation', to, null); console.log('redirecting to licenseActivation', to, null); - next({name: 'licenseActivation'}); + next({ name: 'licenseActivation' }); return; } - if (!joiningClass(to) && loginRequired(to) && await redirectStudentsWithoutClass()) { + if (!joiningClass(to) && loginRequired(to) && (await redirectStudentsWithoutClass())) { //logger.$log.debug('redirecting to join-class', to); //logger.$log.debug('await redirectStudentsWithoutClass()', await redirectStudentsWithoutClass()); - next({name: 'join-class'}); + next({ name: 'join-class' }); return; } - if ((to.name && to.name.indexOf('onboarding') === -1) && !joiningClass(to) && loginRequired(to) && await redirectUsersToOnboarding()) { + if ( + to.name && + to.name.indexOf('onboarding') === -1 && + !joiningClass(to) && + loginRequired(to) && + (await redirectUsersToOnboarding()) + ) { //logger.$log.debug('redirecting to onboarding-start', to); - next({name: 'onboarding-start'}); + next({ name: 'onboarding-start' }); return; } diff --git a/client/src/pages/article.vue b/client/src/pages/article.vue index 9e760089..b587b3e5 100644 --- a/client/src/pages/article.vue +++ b/client/src/pages/article.vue @@ -4,133 +4,140 @@
-

+

{{ roomEntry.title }}

- +
- +