- other committ
This commit is contained in:
5
src/boot/axios.js
Normal file
5
src/boot/axios.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
|
export default ({ Vue }) => {
|
||||||
|
Vue.prototype.$axios = axios
|
||||||
|
}
|
||||||
5
src/boot/dialog.js
Normal file
5
src/boot/dialog.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import Dialog from 'quasar'
|
||||||
|
|
||||||
|
export default ({ Vue }) => {
|
||||||
|
Vue.use(Dialog)
|
||||||
|
}
|
||||||
10
src/boot/dragula.js
Normal file
10
src/boot/dragula.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import { Vue2Dragula } from 'vue2-dragula'
|
||||||
|
|
||||||
|
export default ({ Vue }) => {
|
||||||
|
Vue.use(Vue2Dragula, {
|
||||||
|
logging: {
|
||||||
|
service: false // to only log methods in service (DragulaService)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
7
src/boot/error-handler.js
Normal file
7
src/boot/error-handler.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// import something here
|
||||||
|
import errorHandler from '../error-handler'
|
||||||
|
// leave the export, even if you don't use it
|
||||||
|
export default ({ app, router, Vue }) => {
|
||||||
|
// something to do
|
||||||
|
Vue.prototype.$errorHandler = errorHandler
|
||||||
|
}
|
||||||
8
src/boot/globalroutines.js
Normal file
8
src/boot/globalroutines.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import globalroutines from '../globalroutines'
|
||||||
|
|
||||||
|
export default ({ app, router, store, Vue }) => {
|
||||||
|
// something to do
|
||||||
|
Vue.prototype.$globalroutines = globalroutines
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
89
src/boot/guard.js
Normal file
89
src/boot/guard.js
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
// import something here
|
||||||
|
|
||||||
|
// leave the export, even if you don't use it
|
||||||
|
export default ({ app, router, store, Vue }) => {
|
||||||
|
// something to do
|
||||||
|
|
||||||
|
// ******************************************
|
||||||
|
// *** Per non permettere di accedere alle pagine in cui è necessario essere Loggati ! ***
|
||||||
|
// ******************************************
|
||||||
|
|
||||||
|
// Creates a `nextMiddleware()` function which not only
|
||||||
|
// runs the default `next()` callback but also triggers
|
||||||
|
// the subsequent Middleware function.
|
||||||
|
function nextFactory(context, middleware, index) {
|
||||||
|
const subsequentMiddleware = middleware[index]
|
||||||
|
// If no subsequent Middleware exists,
|
||||||
|
// the default `next()` callback is returned.
|
||||||
|
if (!subsequentMiddleware) return context.next
|
||||||
|
|
||||||
|
return (...parameters) => {
|
||||||
|
// Run the default Vue Router `next()` callback first.
|
||||||
|
context.next(...parameters)
|
||||||
|
// Then run the subsequent Middleware with a new
|
||||||
|
// `nextMiddleware()` callback.
|
||||||
|
const nextMiddleware = nextFactory(context, middleware, index + 1)
|
||||||
|
subsequentMiddleware({ ...context, next: nextMiddleware })
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
router.beforeEach((to, from, next) => {
|
||||||
|
if (to.meta.middleware) {
|
||||||
|
const middleware = Array.isArray(to.meta.middleware)
|
||||||
|
? to.meta.middleware
|
||||||
|
: [to.meta.middleware];
|
||||||
|
|
||||||
|
const context = {
|
||||||
|
from,
|
||||||
|
next,
|
||||||
|
router,
|
||||||
|
to,
|
||||||
|
};
|
||||||
|
const nextMiddleware = nextFactory(context, middleware, 1)
|
||||||
|
|
||||||
|
return middleware[0]({ ...context, next: nextMiddleware })
|
||||||
|
}
|
||||||
|
|
||||||
|
return next()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
/*router.beforeEach((to, from, next) => {
|
||||||
|
var accessToken = store.state.session.userSession.accessToken
|
||||||
|
// ESTANDO LOGEADO
|
||||||
|
if (accessToken) {
|
||||||
|
// SE PERMITE IR DE AREA PUBLICA A PRIVADA
|
||||||
|
if (!from.matched.some(record => record.meta.requiresAuth) && to.matched.some(record => record.meta.requiresAuth)) {
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
// SE PERMITE IR DE UNA AREA PRIVADA A OTRA PRIVADA
|
||||||
|
if (from.matched.some(record => record.meta.requiresAuth) && to.matched.some(record => record.meta.requiresAuth)) {
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
// NO SE PERMITE IR A UN AREA PUBLICA DESDE UN AREA PRIVADA
|
||||||
|
if (from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
|
||||||
|
next(false)
|
||||||
|
}
|
||||||
|
// SE REDIRIJE AL PANEL
|
||||||
|
if (!from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
|
||||||
|
next('/Panel')
|
||||||
|
}
|
||||||
|
// NO ESTA LOGEADO
|
||||||
|
} else {
|
||||||
|
// SE PERMITE IR DE UNA AREA PUBLICA A OTRA PUBLICA
|
||||||
|
if (!from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
// SE PERMITE IR DE UNA AREA PRIVADA A UNA PUBLICA (LOGOUT)
|
||||||
|
if (from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
// NO SE PERMITE IR DE UNA AREA PUBLICA A UNA PRIVADA
|
||||||
|
if (!from.matched.some(record => record.meta.requiresAuth) && to.matched.some(record => record.meta.requiresAuth)) {
|
||||||
|
// REDIRIGIR A LOGIN
|
||||||
|
next('/')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})*/
|
||||||
|
|
||||||
|
}
|
||||||
9
src/boot/myconfig.js
Normal file
9
src/boot/myconfig.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// import something here
|
||||||
|
import myconfig from '../myconfig'
|
||||||
|
|
||||||
|
// leave the export, even if you don't use it
|
||||||
|
export default ({ Vue }) => {
|
||||||
|
//Vue.use(myconfig);
|
||||||
|
// something to do
|
||||||
|
Vue.prototype.$myconfig = myconfig
|
||||||
|
}
|
||||||
5
src/boot/vee-validate.js
Normal file
5
src/boot/vee-validate.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import VeeValidate from "vee-validate";
|
||||||
|
|
||||||
|
export default ({ Vue }) => {
|
||||||
|
Vue.use(VeeValidate, { inject: false })
|
||||||
|
}
|
||||||
46
src/boot/vue-i18n.js
Normal file
46
src/boot/vue-i18n.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
// src/boot/i18n.js
|
||||||
|
import VueI18n from 'vue-i18n';
|
||||||
|
import messages from 'src/statics/i18n';
|
||||||
|
import { tools } from "../store/Modules/tools";
|
||||||
|
|
||||||
|
export default ({ app, store, Vue }) => {
|
||||||
|
Vue.use(VueI18n);
|
||||||
|
// Vue.config.lang = process.env.LANG_DEFAULT;
|
||||||
|
|
||||||
|
let mylang = tools.getItemLS(tools.localStorage.lang)
|
||||||
|
|
||||||
|
if ((navigator) && (mylang === '')) {
|
||||||
|
mylang = navigator.language
|
||||||
|
console.log(`LANG NAVIGATOR ${mylang}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mylang === '')
|
||||||
|
mylang = process.env.LANG_DEFAULT;
|
||||||
|
|
||||||
|
if (mylang.toLowerCase() === 'es-es')
|
||||||
|
mylang = 'esEs'
|
||||||
|
|
||||||
|
console.log('MYLANG2=', mylang)
|
||||||
|
console.log('process.env.LANG_DEFAULT=', process.env.LANG_DEFAULT)
|
||||||
|
Vue.config.lang = mylang
|
||||||
|
|
||||||
|
import(`quasar/lang/${mylang}`).then(lang => {
|
||||||
|
console.log(' ... LANGDEFAULT=', lang)
|
||||||
|
this.$q.lang.set(lang.default)
|
||||||
|
import(`src/statics/i18n`).then(function () {
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// console.log("PLUGINS INIT....");
|
||||||
|
|
||||||
|
//console.log("LANG_DEFAULT: ")
|
||||||
|
//console.log(process.env.LANG_DEFAULT)
|
||||||
|
|
||||||
|
// Set i18n instance on app
|
||||||
|
app.lang = new VueI18n({
|
||||||
|
locale: mylang,
|
||||||
|
fallbackLocale: mylang,
|
||||||
|
messages
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
20
src/boot/vue-idb.js
Normal file
20
src/boot/vue-idb.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import VueIdb from 'vue-idb'
|
||||||
|
|
||||||
|
export default ({ Vue }) => {
|
||||||
|
Vue.use(VueIdb)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
export default new VueIdb({
|
||||||
|
version: 1,
|
||||||
|
database: 'test',
|
||||||
|
schemas: [
|
||||||
|
{ categories: '++_id, sub_categ_id, descr_it' }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
*/
|
||||||
5
src/boot/vuelidate.js
Normal file
5
src/boot/vuelidate.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import Vuelidate from 'vuelidate'
|
||||||
|
|
||||||
|
export default ({ Vue }) => {
|
||||||
|
Vue.use(Vuelidate)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user