Remove vue3-logger
This commit is contained in:
parent
3afeea928f
commit
6ad1df8310
|
|
@ -1,9 +1,9 @@
|
||||||
import 'core-js/stable';
|
import 'core-js/stable';
|
||||||
import {createApp, configureCompat } from 'vue';
|
import { createApp, configureCompat } from 'vue';
|
||||||
import VueVimeoPlayer from 'vue-vimeo-player';
|
import VueVimeoPlayer from 'vue-vimeo-player';
|
||||||
import apolloClientFactory from './graphql/client';
|
import apolloClientFactory from './graphql/client';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
import {postLoginRedirectUrlKey, router} from './router';
|
import { postLoginRedirectUrlKey, router } from './router';
|
||||||
import { store } from '@/store';
|
import { store } from '@/store';
|
||||||
import VueScrollTo from 'vue-scrollto';
|
import VueScrollTo from 'vue-scrollto';
|
||||||
import autoGrow from '@/directives/auto-grow';
|
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 VueModal from '@/plugins/modal';
|
||||||
import VueRemoveEdges from '@/plugins/edges';
|
import VueRemoveEdges from '@/plugins/edges';
|
||||||
import VueMatomo from 'vue-matomo';
|
import VueMatomo from 'vue-matomo';
|
||||||
import VueLogger from 'vuejs3-logger';
|
|
||||||
import { createApolloProvider } from '@vue/apollo-option';
|
import { createApolloProvider } from '@vue/apollo-option';
|
||||||
import { joiningClass, loginRequired, unauthorizedAccess } from '@/router/guards';
|
import { joiningClass, loginRequired, unauthorizedAccess } from '@/router/guards';
|
||||||
import flavorPlugin from '@/plugins/flavor';
|
import flavorPlugin from '@/plugins/flavor';
|
||||||
|
|
@ -28,24 +27,16 @@ const apolloProvider = createApolloProvider({
|
||||||
});
|
});
|
||||||
|
|
||||||
configureCompat({
|
configureCompat({
|
||||||
MODE: 2
|
MODE: 2,
|
||||||
});
|
});
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|
||||||
app.use(store);
|
app.use(store);
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV === 'production';
|
|
||||||
|
|
||||||
app.use(VueModal);
|
app.use(VueModal);
|
||||||
app.use(VueRemoveEdges);
|
app.use(VueRemoveEdges);
|
||||||
app.use(VueVimeoPlayer);
|
app.use(VueVimeoPlayer);
|
||||||
app.use(VueLogger, {
|
|
||||||
isEnabled: true,
|
|
||||||
logLevel: isProduction ? 'error' : 'debug',
|
|
||||||
stringifyArguments: false,
|
|
||||||
showConsoleColors: true,
|
|
||||||
});
|
|
||||||
app.use(apolloProvider);
|
app.use(apolloProvider);
|
||||||
app.use(router);
|
app.use(router);
|
||||||
|
|
||||||
|
|
@ -57,7 +48,6 @@ app.use(router);
|
||||||
|
|
||||||
app.directive('scroll-to', VueScrollTo);
|
app.directive('scroll-to', VueScrollTo);
|
||||||
|
|
||||||
|
|
||||||
app.use(flavorPlugin);
|
app.use(flavorPlugin);
|
||||||
|
|
||||||
if (process.env.MATOMO_HOST) {
|
if (process.env.MATOMO_HOST) {
|
||||||
|
|
@ -73,33 +63,36 @@ app.directive('auto-grow', autoGrow);
|
||||||
|
|
||||||
/* guards */
|
/* guards */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function redirectUsersWithoutValidLicense() {
|
function redirectUsersWithoutValidLicense() {
|
||||||
return privateApolloClient.query({
|
return privateApolloClient
|
||||||
query: ME_QUERY,
|
.query({
|
||||||
}).then(({data}) => data.me.expiryDate == null);
|
query: ME_QUERY,
|
||||||
|
})
|
||||||
|
.then(({ data }) => data.me.expiryDate == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirectStudentsWithoutClass() {
|
function redirectStudentsWithoutClass() {
|
||||||
return privateApolloClient.query({
|
return privateApolloClient
|
||||||
query: ME_QUERY,
|
.query({
|
||||||
}).then(({data}) => data.me.schoolClasses.length === 0 && !data.me.isTeacher);
|
query: ME_QUERY,
|
||||||
|
})
|
||||||
|
.then(({ data }) => data.me.schoolClasses.length === 0 && !data.me.isTeacher);
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirectUsersToOnboarding() {
|
function redirectUsersToOnboarding() {
|
||||||
return privateApolloClient.query({
|
return privateApolloClient
|
||||||
query: ME_QUERY,
|
.query({
|
||||||
}).then(({data}) => !data.me.onboardingVisited);
|
query: ME_QUERY,
|
||||||
|
})
|
||||||
|
.then(({ data }) => !data.me.onboardingVisited);
|
||||||
}
|
}
|
||||||
|
|
||||||
function networkErrorCallback(statusCode) {
|
function networkErrorCallback(statusCode) {
|
||||||
if (statusCode === 402) {
|
if (statusCode === 402) {
|
||||||
router.push({name: 'licenseActivation'});
|
router.push({ name: 'licenseActivation' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
// todo: make logger work outside vue app
|
// todo: make logger work outside vue app
|
||||||
// const logger = inject('vuejs3-logger');
|
// const logger = inject('vuejs3-logger');
|
||||||
|
|
@ -111,7 +104,7 @@ router.beforeEach(async (to, from, next) => {
|
||||||
next(false);
|
next(false);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
next({name: 'hello'});
|
next({ name: 'hello' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -130,23 +123,29 @@ router.beforeEach(async (to, from, next) => {
|
||||||
return;
|
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);
|
// logger.$log.debug('redirecting to licenseActivation', to, null);
|
||||||
console.log('redirecting to licenseActivation', to, null);
|
console.log('redirecting to licenseActivation', to, null);
|
||||||
next({name: 'licenseActivation'});
|
next({ name: 'licenseActivation' });
|
||||||
return;
|
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('redirecting to join-class', to);
|
||||||
//logger.$log.debug('await redirectStudentsWithoutClass()', await redirectStudentsWithoutClass());
|
//logger.$log.debug('await redirectStudentsWithoutClass()', await redirectStudentsWithoutClass());
|
||||||
next({name: 'join-class'});
|
next({ name: 'join-class' });
|
||||||
return;
|
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);
|
//logger.$log.debug('redirecting to onboarding-start', to);
|
||||||
next({name: 'onboarding-start'});
|
next({ name: 'onboarding-start' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue