0)return;this.setFrameCount(1);var i,n,a=e.currentTarget.getBoundingClientRect();if(0===e.clientX&&0===e.clientY)i=Math.round(a.width/2),n=Math.round(a.height/2);else{var l=void 0!==e.clientX?e.clientX:e.touches[0].clientX,o=void 0!==e.clientY?e.clientY:e.touches[0].clientY;i=Math.round(l-a.left),n=Math.round(o-a.top)}this.setRippleXY(i,n),this.setRippleStyles(!0),window.requestAnimationFrame(this.animFrameHandler.bind(this))}},S.prototype.upHandler_=function(e){e&&2!==e.detail&&window.setTimeout(function(){this.rippleElement_.classList.remove(this.CssClasses_.IS_VISIBLE)}.bind(this),0)},S.prototype.init=function(){if(this.element_){var e=this.element_.classList.contains(this.CssClasses_.RIPPLE_CENTER);this.element_.classList.contains(this.CssClasses_.RIPPLE_EFFECT_IGNORE_EVENTS)||(this.rippleElement_=this.element_.querySelector("."+this.CssClasses_.RIPPLE),this.frameCount_=0,this.rippleSize_=0,this.x_=0,this.y_=0,this.ignoringMouseDown_=!1,this.boundDownHandler=this.downHandler_.bind(this),this.element_.addEventListener("mousedown",this.boundDownHandler),this.element_.addEventListener("touchstart",this.boundDownHandler),this.boundUpHandler=this.upHandler_.bind(this),this.element_.addEventListener("mouseup",this.boundUpHandler),this.element_.addEventListener("mouseleave",this.boundUpHandler),this.element_.addEventListener("touchend",this.boundUpHandler),this.element_.addEventListener("blur",this.boundUpHandler),this.getFrameCount=function(){return this.frameCount_},this.setFrameCount=function(e){this.frameCount_=e},this.getRippleElement=function(){return this.rippleElement_},this.setRippleXY=function(e,t){this.x_=e,this.y_=t},this.setRippleStyles=function(t){if(null!==this.rippleElement_){var s,i,n,a="translate("+this.x_+"px, "+this.y_+"px)";t?(i=this.Constant_.INITIAL_SCALE,n=this.Constant_.INITIAL_SIZE):(i=this.Constant_.FINAL_SCALE,n=this.rippleSize_+"px",e&&(a="translate("+this.boundWidth/2+"px, "+this.boundHeight/2+"px)")),s="translate(-50%, -50%) "+a+i,this.rippleElement_.style.webkitTransform=s,this.rippleElement_.style.msTransform=s,this.rippleElement_.style.transform=s,t?this.rippleElement_.classList.remove(this.CssClasses_.IS_ANIMATING):this.rippleElement_.classList.add(this.CssClasses_.IS_ANIMATING)}},this.animFrameHandler=function(){this.frameCount_-- >0?window.requestAnimationFrame(this.animFrameHandler.bind(this)):this.setRippleStyles(!1)})}},s.register({constructor:S,classAsString:"MaterialRipple",cssClass:"mdl-js-ripple-effect",widget:!1})}();
-//# sourceMappingURL=material.min.js.map
diff --git a/src/assets/js/promise.js b/src/assets/js/promise.js
deleted file mode 100644
index dd5e735..0000000
--- a/src/assets/js/promise.js
+++ /dev/null
@@ -1,372 +0,0 @@
-/**
- * setImmediate polyfill v1.0.1, supports IE9+
- * © 2014–2015 Dmitry Korobkin
- * Released under the MIT license
- * github.com/Octane/setImmediate
- */
-window.setImmediate || function () {'use strict';
-
- var uid = 0;
- var storage = {};
- var firstCall = true;
- var slice = Array.prototype.slice;
- var message = 'setImmediatePolyfillMessage';
-
- function fastApply(args) {
- var func = args[0];
- switch (args.length) {
- case 1:
- return func();
- case 2:
- return func(args[1]);
- case 3:
- return func(args[1], args[2]);
- }
- return func.apply(window, slice.call(args, 1));
- }
-
- function callback(event) {
- var key = event.data;
- var data;
- if (typeof key == 'string' && key.indexOf(message) == 0) {
- data = storage[key];
- if (data) {
- delete storage[key];
- fastApply(data);
- }
- }
- }
-
- window.setImmediate = function setImmediate() {
- var id = uid++;
- var key = message + id;
- var i = arguments.length;
- var args = new Array(i);
- while (i--) {
- args[i] = arguments[i];
- }
- storage[key] = args;
- if (firstCall) {
- firstCall = false;
- window.addEventListener('message', callback);
- }
- window.postMessage(key, '*');
- return id;
- };
-
- window.clearImmediate = function clearImmediate(id) {
- delete storage[message + id];
- };
-
-}();
-
-/**
- * Promise polyfill v1.0.10
- * requires setImmediate
- *
- * © 2014–2015 Dmitry Korobkin
- * Released under the MIT license
- * github.com/Octane/Promise
- */
-(function (global) {'use strict';
-
- var STATUS = '[[PromiseStatus]]';
- var VALUE = '[[PromiseValue]]';
- var ON_FUlFILLED = '[[OnFulfilled]]';
- var ON_REJECTED = '[[OnRejected]]';
- var ORIGINAL_ERROR = '[[OriginalError]]';
- var PENDING = 'pending';
- var INTERNAL_PENDING = 'internal pending';
- var FULFILLED = 'fulfilled';
- var REJECTED = 'rejected';
- var NOT_ARRAY = 'not an array.';
- var REQUIRES_NEW = 'constructor Promise requires "new".';
- var CHAINING_CYCLE = 'then() cannot return same Promise that it resolves.';
-
- var setImmediate = global.setImmediate || require('timers').setImmediate;
- var isArray = Array.isArray || function (anything) {
- return Object.prototype.toString.call(anything) == '[object Array]';
- };
-
- function InternalError(originalError) {
- this[ORIGINAL_ERROR] = originalError;
- }
-
- function isInternalError(anything) {
- return anything instanceof InternalError;
- }
-
- function isObject(anything) {
- //Object.create(null) instanceof Object → false
- return Object(anything) === anything;
- }
-
- function isCallable(anything) {
- return typeof anything == 'function';
- }
-
- function isPromise(anything) {
- return anything instanceof Promise;
- }
-
- function identity(value) {
- return value;
- }
-
- function thrower(reason) {
- throw reason;
- }
-
- function enqueue(promise, onFulfilled, onRejected) {
- if (!promise[ON_FUlFILLED]) {
- promise[ON_FUlFILLED] = [];
- promise[ON_REJECTED] = [];
- }
- promise[ON_FUlFILLED].push(onFulfilled);
- promise[ON_REJECTED].push(onRejected);
- }
-
- function clearAllQueues(promise) {
- delete promise[ON_FUlFILLED];
- delete promise[ON_REJECTED];
- }
-
- function callEach(queue) {
- var i;
- var length = queue.length;
- for (i = 0; i < length; i++) {
- queue[i]();
- }
- }
-
- function call(resolve, reject, value) {
- var anything = toPromise(value);
- if (isPromise(anything)) {
- anything.then(resolve, reject);
- } else if (isInternalError(anything)) {
- reject(anything[ORIGINAL_ERROR]);
- } else {
- resolve(value);
- }
- }
-
- function toPromise(anything) {
- var then;
- if (isPromise(anything)) {
- return anything;
- }
- if(isObject(anything)) {
- try {
- then = anything.then;
- } catch (error) {
- return new InternalError(error);
- }
- if (isCallable(then)) {
- return new Promise(function (resolve, reject) {
- setImmediate(function () {
- try {
- then.call(anything, resolve, reject);
- } catch (error) {
- reject(error);
- }
- });
- });
- }
- }
- return null;
- }
-
- function resolvePromise(promise, resolver) {
- function resolve(value) {
- if (promise[STATUS] == PENDING) {
- fulfillPromise(promise, value);
- }
- }
- function reject(reason) {
- if (promise[STATUS] == PENDING) {
- rejectPromise(promise, reason);
- }
- }
- try {
- resolver(resolve, reject);
- } catch(error) {
- reject(error);
- }
- }
-
- function fulfillPromise(promise, value) {
- var queue;
- var anything = toPromise(value);
- if (isPromise(anything)) {
- promise[STATUS] = INTERNAL_PENDING;
- anything.then(
- function (value) {
- fulfillPromise(promise, value);
- },
- function (reason) {
- rejectPromise(promise, reason);
- }
- );
- } else if (isInternalError(anything)) {
- rejectPromise(promise, anything[ORIGINAL_ERROR]);
- } else {
- promise[STATUS] = FULFILLED;
- promise[VALUE] = value;
- queue = promise[ON_FUlFILLED];
- if (queue && queue.length) {
- clearAllQueues(promise);
- callEach(queue);
- }
- }
- }
-
- function rejectPromise(promise, reason) {
- var queue = promise[ON_REJECTED];
- promise[STATUS] = REJECTED;
- promise[VALUE] = reason;
- if (queue && queue.length) {
- clearAllQueues(promise);
- callEach(queue);
- }
- }
-
- function Promise(resolver) {
- var promise = this;
- if (!isPromise(promise)) {
- throw new TypeError(REQUIRES_NEW);
- }
- promise[STATUS] = PENDING;
- promise[VALUE] = undefined;
- resolvePromise(promise, resolver);
- }
-
- Promise.prototype.then = function (onFulfilled, onRejected) {
- var promise = this;
- var nextPromise;
- onFulfilled = isCallable(onFulfilled) ? onFulfilled : identity;
- onRejected = isCallable(onRejected) ? onRejected : thrower;
- nextPromise = new Promise(function (resolve, reject) {
- function tryCall(func) {
- var value;
- try {
- value = func(promise[VALUE]);
- } catch (error) {
- reject(error);
- return;
- }
- if (value === nextPromise) {
- reject(new TypeError(CHAINING_CYCLE));
- } else {
- call(resolve, reject, value);
- }
- }
- function asyncOnFulfilled() {
- setImmediate(tryCall, onFulfilled);
- }
- function asyncOnRejected() {
- setImmediate(tryCall, onRejected);
- }
- switch (promise[STATUS]) {
- case FULFILLED:
- asyncOnFulfilled();
- break;
- case REJECTED:
- asyncOnRejected();
- break;
- default:
- enqueue(promise, asyncOnFulfilled, asyncOnRejected);
- }
- });
- return nextPromise;
- };
-
- Promise.prototype['catch'] = function (onRejected) {
- return this.then(identity, onRejected);
- };
-
- Promise.resolve = function (value) {
- var anything = toPromise(value);
- if (isPromise(anything)) {
- return anything;
- }
- return new Promise(function (resolve, reject) {
- if (isInternalError(anything)) {
- reject(anything[ORIGINAL_ERROR]);
- } else {
- resolve(value);
- }
- });
- };
-
- Promise.reject = function (reason) {
- return new Promise(function (resolve, reject) {
- reject(reason);
- });
- };
-
- Promise.race = function (values) {
- return new Promise(function (resolve, reject) {
- var i;
- var length;
- if (isArray(values)) {
- length = values.length;
- for (i = 0; i < length; i++) {
- call(resolve, reject, values[i]);
- }
- } else {
- reject(new TypeError(NOT_ARRAY));
- }
- });
- };
-
- Promise.all = function (values) {
- return new Promise(function (resolve, reject) {
- var fulfilledCount = 0;
- var promiseCount = 0;
- var anything;
- var length;
- var value;
- var i;
- if (isArray(values)) {
- values = values.slice(0);
- length = values.length;
- for (i = 0; i < length; i++) {
- value = values[i];
- anything = toPromise(value);
- if (isPromise(anything)) {
- promiseCount++;
- anything.then(
- function (index) {
- return function (value) {
- values[index] = value;
- fulfilledCount++;
- if (fulfilledCount == promiseCount) {
- resolve(values);
- }
- };
- }(i),
- reject
- );
- } else if (isInternalError(anything)) {
- reject(anything[ORIGINAL_ERROR]);
- } else {
- //[1, , 3] → [1, undefined, 3]
- values[i] = value;
- }
- }
- if (!promiseCount) {
- resolve(values);
- }
- } else {
- reject(new TypeError(NOT_ARRAY));
- }
- });
- };
-
- if (typeof module != 'undefined' && module.exports) {
- module.exports = global.Promise || Promise;
- } else if (!global.Promise) {
- global.Promise = Promise;
- }
-
-}(this));
\ No newline at end of file
diff --git a/src/assets/js/storage.js b/src/assets/js/storage.js
deleted file mode 100644
index 5dc436f..0000000
--- a/src/assets/js/storage.js
+++ /dev/null
@@ -1,126 +0,0 @@
-let idbKeyval = (() => {
- let db;
- // console.log('idbKeyval...')
-
- function getDB() {
- if (!db) {
- // console.log('CREO DB STORAGE JS !')
- db = new Promise((resolve, reject) => {
- const openreq = indexedDB.open('mydb3', 11);
-
- openreq.onerror = () => {
- reject(openreq.error);
- };
-
- openreq.onupgradeneeded = () => {
- // First time setup: create an empty object store
- openreq.result.createObjectStore('todos', { keyPath: '_id' });
- openreq.result.createObjectStore('categories', { keyPath: '_id' });
- openreq.result.createObjectStore('sync_todos', { keyPath: '_id' });
- openreq.result.createObjectStore('sync_todos_patch', { keyPath: '_id' });
- openreq.result.createObjectStore('delete_todos', { keyPath: '_id' });
- openreq.result.createObjectStore('config', { keyPath: '_id' });
- openreq.result.createObjectStore('swmsg', { keyPath: '_id' });
- };
-
- openreq.onsuccess = () => {
- resolve(openreq.result);
- };
- });
- }
- return db;
- }
-
- async function withStore(type, table, callback, ) {
- const db = await getDB();
- return new Promise((resolve, reject) => {
- const transaction = db.transaction(table, type);
- transaction.oncomplete = () => resolve();
- transaction.onerror = () => reject(transaction.error);
- callback(transaction.objectStore(table));
- });
- }
-
- return {
- async get(key) {
- let req;
- await withStore('readonly', 'keyval', store => {
- req = store.get(key);
- });
- return req.result;
- },
-
- // jsonCopy(src) {
- // return JSON.parse(JSON.stringify(src));
- // },
-
- // contains(a, b) {
- // // array matches
- // if (Array.isArray(b)) {
- // return b.some(x => a.indexOf(x) > -1);
- // }
- // // string match
- // return a.indexOf(b) > -1;
- // },
-
- async getdata(table, key) {
- let req;
-
- await withStore('readonly', table, store => {
- // console.log('store', store, 'key', key)
- req = store.get(key);
- });
-
- return req.result;
- },
- async getalldata(table) {
- let req;
- await withStore('readonly', table, store => {
- req = store.getAll();
- });
- return req.result;
- },
- async set(key, value) {
- let req;
- await withStore('readwrite', 'keyval', store => {
- req = store.put(value, key);
- });
- return req.result;
- },
- async setdata(table, value) {
- let req;
- // console.log('setdata', table, value)
-
- await withStore('readwrite', table, store => {
- req = store.put(value);
- });
- return req.result;
- },
- async delete(key) {
- return await withStore('readwrite', 'keyval', store => {
- store.delete(key);
- });
- },
- async deletedata(table, key) {
- return await withStore('readwrite', table, store => {
- store.delete(key);
- });
- },
- async clearalldata(table) {
- // console.log('clearalldata', table)
- return await withStore('readwrite', table, store => {
- store.clear();
- });
- }
- };
-})();
-
-// iOS add-to-homescreen is missing IDB, or at least it used to.
-// I haven't tested this in a while.
-if (!self.indexedDB) {
- idbKeyval = {
- get: key => Promise.resolve(localStorage.getItem(key)),
- set: (key, val) => Promise.resolve(localStorage.setItem(key, val)),
- delete: key => Promise.resolve(localStorage.removeItem(key))
- };
-}
diff --git a/src/components/Header.vue b/src/components/Header.vue
index bf4a524..adc4926 100644
--- a/src/components/Header.vue
+++ b/src/components/Header.vue
@@ -237,10 +237,10 @@
}
public selectOpLang = [
- { label: 'English', icon: 'fa-flag-us', value: 'enUs', image: '../assets/images/gb.png', short: 'EN' },
- // { label: 'German', icon: 'fa-flag-de', value: 'de', image: '../assets/images/de.png', short: 'DE' },
- { label: 'Italiano', icon: 'fa-facebook', value: 'it', image: '../assets/images/it.png', short: 'IT' },
- { label: 'Español', icon: 'fa-flag-es', value: 'esEs', image: '../assets/images/es.png', short: 'ES' }
+ { label: 'English', icon: 'fa-flag-us', value: 'enUs', image: '../statics/images/gb.png', short: 'EN' },
+ // { label: 'German', icon: 'fa-flag-de', value: 'de', image: '../statics/images/de.png', short: 'DE' },
+ { label: 'Italiano', icon: 'fa-facebook', value: 'it', image: '../statics/images/it.png', short: 'IT' },
+ { label: 'Español', icon: 'fa-flag-es', value: 'esEs', image: '../statics/images/es.png', short: 'ES' }
]
@@ -329,7 +329,7 @@
// dynamic import, so loading on demand only
import(`quasar-framework/i18n/${mylangtopass}`).then(lang => {
this.$q.i18n.set(lang.default)
- import(`src/assets/i18n`).then(function () {
+ import(`src/statics/i18n`).then(function () {
})
})
}
diff --git a/src/components/logo/logo.ts b/src/components/logo/logo.ts
index c70501e..5c43ec4 100644
--- a/src/components/logo/logo.ts
+++ b/src/components/logo/logo.ts
@@ -13,7 +13,7 @@ export default class Logo extends Vue {
logoimg: string = ''
created() {
- this.logoimg = 'assets/images/' + process.env.LOGO_REG
+ this.logoimg = 'statics/images/' + process.env.LOGO_REG
this.animate()
}
diff --git a/src/components/offline/offline.ts b/src/components/offline/offline.ts
index 455a3a0..1a3cd52 100644
--- a/src/components/offline/offline.ts
+++ b/src/components/offline/offline.ts
@@ -13,7 +13,7 @@ export default class Offline extends Vue {
logoimg: string = ''
created() {
- this.logoimg = '/assets/images/' + process.env.LOGO_REG
+ this.logoimg = '/statics/images/' + process.env.LOGO_REG
this.animate()
}
diff --git a/src/components/todos/todo/todo.ts b/src/components/todos/todo/todo.ts
index 59c8f7d..fc9671f 100644
--- a/src/components/todos/todo/todo.ts
+++ b/src/components/todos/todo/todo.ts
@@ -69,7 +69,7 @@ export default class Todo extends Vue {
}
set showtype (value) {
- // console.log('showtype', value)
+ console.log('showtype', value)
GlobalStore.mutations.setShowType(value)
}
diff --git a/src/globalroutines/util.js b/src/globalroutines/util.js
index 4e50d98..565e4c5 100644
--- a/src/globalroutines/util.js
+++ b/src/globalroutines/util.js
@@ -1,5 +1,5 @@
import { UserStore } from "../store/Modules";
-import messages from "../assets/i18n";
+import messages from "../statics/i18n";
function translate(params) {
let msg = params.split('.')
diff --git a/src/index.template.html b/src/index.template.html
index b50f0e9..ba11dae 100644
--- a/src/index.template.html
+++ b/src/index.template.html
@@ -13,12 +13,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/middleware/auth.js b/src/middleware/auth.js
new file mode 100644
index 0000000..b01c5cf
--- /dev/null
+++ b/src/middleware/auth.js
@@ -0,0 +1,12 @@
+import { tools } from "../store/Modules/tools";
+
+import { RouteNames } from '../router/route-names'
+
+export default function auth({ next, router }) {
+ const tok = tools.getItemLS(tools.localStorage.token)
+ if (!tok) {
+ return router.push({ name: RouteNames.login });
+ }
+
+ return next();
+}
diff --git a/src/plugins/guard.js b/src/plugins/guard.js
index 1dc69bc..45dde93 100644
--- a/src/plugins/guard.js
+++ b/src/plugins/guard.js
@@ -8,8 +8,47 @@ export default ({ app, router, store, Vue }) => {
// *** 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) {
@@ -45,6 +84,6 @@ export default ({ app, router, store, Vue }) => {
next('/')
}
}
- })
- */
+ })*/
+
}
diff --git a/src/plugins/i18n.js b/src/plugins/i18n.js
index 60a1a0a..8ca36c0 100644
--- a/src/plugins/i18n.js
+++ b/src/plugins/i18n.js
@@ -1,6 +1,6 @@
// src/plugins/i18n.js
import VueI18n from 'vue-i18n';
-import messages from 'src/assets/i18n';
+import messages from 'src/statics/i18n';
import { tools } from "../store/Modules/tools";
export default ({ app, store, Vue }) => {
diff --git a/src/root/home/home.scss b/src/root/home/home.scss
index 6c5e9fa..365d49a 100644
--- a/src/root/home/home.scss
+++ b/src/root/home/home.scss
@@ -3,7 +3,7 @@
}
.landing {
- background: #000 url(../../assets/images/cover.jpg) no-repeat 50% fixed;
+ background: #000 url(../../statics/images/cover.jpg) no-repeat 50% fixed;
background-size: cover
}
@@ -142,7 +142,7 @@ body.mobile .landing:before {
right: 0;
bottom: 0;
z-index: -1;
- background: #000 url(../../assets/images/cover.jpg) 50%;
+ background: #000 url(../../statics/images/cover.jpg) 50%;
background-size: cover
}
diff --git a/src/root/home/home.ts b/src/root/home/home.ts
index 4579132..20508b3 100644
--- a/src/root/home/home.ts
+++ b/src/root/home/home.ts
@@ -112,7 +112,7 @@ export default class Home extends Vue {
options = {
body: 'You successfully subscribed to our Notification service!',
icon: '/statics/icons/app-icon-96x96.png',
- image: '/assets/images/sf-boat.jpg',
+ image: '/statics/images/sf-boat.jpg',
dir: 'ltr',
lang: 'enUs', // BCP 47,
vibrate: [100, 50, 200],
@@ -169,7 +169,7 @@ export default class Home extends Vue {
options = {
body: mythis.$t('notification.subscribed'),
icon: '/statics/icons/android-chrome-192x192.png',
- image: '/assets/images/freeplanet.png',
+ image: '/statics/images/freeplanet.png',
dir: 'ltr',
lang: 'enUs', // BCP 47,
vibrate: [100, 50, 200],
diff --git a/src/root/home/home.vue b/src/root/home/home.vue
index 6a97d94..5c6cb7c 100644
--- a/src/root/home/home.vue
+++ b/src/root/home/home.vue
@@ -18,16 +18,6 @@
{{$t('msg.sottoTitoloApp3')}}
-
-
-
-
-
-
+
+
+
+
diff --git a/src/root/home/old-home.vue b/src/root/home/old-home.vue
index efdb3be..a80a15e 100644
--- a/src/root/home/old-home.vue
+++ b/src/root/home/old-home.vue
@@ -50,7 +50,7 @@
-
+
diff --git a/src/router/route-config.ts b/src/router/route-config.ts
index e789834..382d662 100644
--- a/src/router/route-config.ts
+++ b/src/router/route-config.ts
@@ -1,54 +1,59 @@
import { RouteConfig as VueRouteConfig } from 'vue-router'
import { RouteNames } from './route-names'
+import { tools } from '@src/store/Modules/tools'
+
+import auth from '../middleware/auth'
+
export const RouteConfig: VueRouteConfig[] = [
{
- component: () => import('@/root/home/home.vue'),
- name: RouteNames.home,
path: '/',
- meta: { name: 'Home' }
+ name: RouteNames.home,
+ component: () => import('@/root/home/home.vue')
},
{
path: '/signup',
- component: () => import('@/views/login/signup/signup.vue'),
- meta: { name: 'Registration' }
+ name: 'Registration',
+ component: () => import('@/views/login/signup/signup.vue')
},
{
path: '/signin',
- component: () => import('@/views/login/signin/signin.vue'),
- meta: { name: 'Login' }
+ name: RouteNames.login,
+ component: () => import('@/views/login/signin/signin.vue')
},
{
path: '/vreg',
- component: () => import('@/views/login/vreg/vreg.vue'),
- meta: { name: 'Verify Reg' }
+ name: 'Verify Reg',
+ component: () => import('@/views/login/vreg/vreg.vue')
},
{
path: '/todo/:category',
+ name: 'Todos',
component: () => import('@/components/todos/todo/todo.vue'),
- // props: { category: 'personal' },
- meta: { name: 'Todos' }
+ meta: {
+ middleware: [auth]
+ }
},
{
path: '/category',
- component: () => import('@/components/categories/category/category.vue'),
- meta: { name: 'Categories' }
+ name: 'category',
+ component: () => import('@/components/categories/category/category.vue')
},
{
path: '/admin/cfgserv',
- component: () => import('@/components/admin/cfgServer/cfgServer.vue'),
- meta: { name: 'Categories' }
+ name: 'cfgserv',
+ component: () => import('@/components/admin/cfgServer/cfgServer.vue')
},
{
path: '/admin/testp1/:category',
- component: () => import('@/components/admin/testp1/testp1.vue'),
- meta: { name: 'Categories' }
+ name: 'Categories',
+ component: () => import('@/components/admin/testp1/testp1.vue')
},
{
path: '/offline',
- component: () => import('@/components/offline/offline.vue'),
- meta: { name: 'Offline' }
+ name: 'Offline',
+ component: () => import('@/components/offline/offline.vue')
}
/*
{
@@ -74,4 +79,3 @@ export const RouteConfig: VueRouteConfig[] = [
meta: { name: 'Embeeded' }
}*/
]
-
diff --git a/src/store/Api/Inst-Pao.ts b/src/store/Api/Inst-Pao.ts
index cb1b04c..328ba05 100644
--- a/src/store/Api/Inst-Pao.ts
+++ b/src/store/Api/Inst-Pao.ts
@@ -4,7 +4,8 @@ import * as Types from '@src/store/Api/ApiTypes'
async function sendRequest(url: string, method: string, mydata: any) {
- console.log('sendRequest', method, url)
+ if (!process.env.DEBUG)
+ console.log('sendRequest', method, url)
let request
if (method === 'GET')
diff --git a/src/store/Api/Instance.ts b/src/store/Api/Instance.ts
index a67cdce..a916607 100644
--- a/src/store/Api/Instance.ts
+++ b/src/store/Api/Instance.ts
@@ -17,12 +17,14 @@ export const axiosInstance: AxiosInstance = axios.create({
axiosInstance.interceptors.response.use(
(response) => {
- console.log(response)
+ if (process.env.DEBUG === '1')
+ console.log(response)
return response
},
(error) => {
if (error.response) {
- console.log(error.response.status)
+ if (process.env.DEBUG === '1')
+ console.log(error.response.status)
console.log('Request Error: ', error.response)
}
return Promise.reject(error)
diff --git a/src/store/Modules/GlobalStore.ts b/src/store/Modules/GlobalStore.ts
index 5a79b45..57598ba 100644
--- a/src/store/Modules/GlobalStore.ts
+++ b/src/store/Modules/GlobalStore.ts
@@ -7,7 +7,7 @@ import translate from './../../globalroutines/util'
import urlBase64ToUint8Array from '../../js/utility'
-import messages from '../../assets/i18n'
+import messages from '../../statics/i18n'
import { GlobalStore, Todos, UserStore } from '@store'
import globalroutines from './../../globalroutines/index'
import Api from '@api'
@@ -62,11 +62,15 @@ async function getConfig(id) {
async function getstateConnSaved() {
const config = await getConfig(costanti.CONFIG_ID_CFG)
console.log('config', config)
- if (config.length > 1) {
- const cfgstateconn = config[1]
- return cfgstateconn.stateconn
+ if (config) {
+ if (config.length > 1) {
+ const cfgstateconn = config[1]
+ return cfgstateconn.stateconn
+ } else {
+ return 'online'
+ }
} else {
- return 'online'
+ return 'offline'
}
}
@@ -84,12 +88,12 @@ namespace Getters {
const testpao1_getter_array = b.read(state => param1 => state.testp1.mioarray.filter(item => item).map(item => item.valore), 'testpao1_getter_array')
const getConfigbyId = b.read(state => id => state.arrConfig.find(item => item._id === id), 'getConfigbyId')
- const getConfigStringbyId = b.read(state => id => {
- const config = state.arrConfig.find(item => item._id === id)
+ const getConfigStringbyId = b.read(state => params => {
+ const config = state.arrConfig.find(item => item._id === params.id)
if (config) {
return config.value
} else {
- return ''
+ return params.default
}
}, 'getConfigStringbyId')
@@ -199,15 +203,18 @@ namespace Mutations {
}
function setShowType(state: IGlobalState, showtype: number) {
- // console.log('setShowType', showtype)
+ console.log('setShowType', showtype)
const config = Getters.getters.getConfigbyId(costanti.CONFIG_ID_SHOW_TYPE_TODOS)
- // console.log('config', config)
+ console.log('config', config)
if (config) {
config.value = String(showtype)
Todos.state.showtype = parseInt(config.value)
- // console.log('Todos.state.showtype', Todos.state.showtype)
- GlobalStore.mutations.saveConfig({ _id: costanti.CONFIG_ID_SHOW_TYPE_TODOS, value: String(showtype) })
+ } else {
+ Todos.state.showtype = showtype
}
+ console.log('Todos.state.showtype', Todos.state.showtype)
+ GlobalStore.mutations.saveConfig({ _id: costanti.CONFIG_ID_SHOW_TYPE_TODOS, value: String(showtype) })
+
}
export const mutations = {
diff --git a/src/store/Modules/Todos.ts b/src/store/Modules/Todos.ts
index 23af60e..5eea7ae 100644
--- a/src/store/Modules/Todos.ts
+++ b/src/store/Modules/Todos.ts
@@ -404,7 +404,8 @@ namespace Actions {
return sendSwMsgIfAvailable()
.then(something => {
if (something) {
- console.log('something')
+ if (process.env.DEBUG === '1')
+ console.log('something')
// Refresh data
return waitAndRefreshData(context)
}
@@ -482,13 +483,13 @@ namespace Actions {
// console.log('PRIMA showtype = ', state.showtype)
- state.showtype = parseInt(GlobalStore.getters.getConfigStringbyId(costanti.CONFIG_ID_SHOW_TYPE_TODOS))
+ state.showtype = parseInt(GlobalStore.getters.getConfigStringbyId({id: costanti.CONFIG_ID_SHOW_TYPE_TODOS, default: costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED }))
// console.log('showtype = ', state.showtype)
// console.log('ARRAY TODOS = ', state.todos)
-
- console.log('dbLoadTodo', 'state.todos', state.todos, 'state.categories', state.categories)
+ if (process.env.DEBUG === '1')
+ console.log('dbLoadTodo', 'state.todos', state.todos, 'state.categories', state.categories)
return res
})
@@ -499,7 +500,8 @@ namespace Actions {
})
if (ris.status !== 200) {
- console.log('ris.status', ris.status)
+ if (process.env.DEBUG === '1')
+ console.log('ris.status', ris.status)
if (ris.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
consolelogpao('UNAUTHORIZING... TOKEN EXPIRED... !! ')
} else {
diff --git a/src/store/Modules/UserStore.ts b/src/store/Modules/UserStore.ts
index bccf12e..696ab60 100644
--- a/src/store/Modules/UserStore.ts
+++ b/src/store/Modules/UserStore.ts
@@ -367,7 +367,7 @@ namespace Actions {
}
async function signin(context, authData: ISigninOptions) {
- console.log('LOGIN signin')
+ // console.log('LOGIN signin')
// console.log('MYLANG = ' + state.lang)
@@ -406,8 +406,8 @@ namespace Actions {
}
// console.log('PASSO 4')
-
- console.log(usertosend)
+ if (process.env.DEBUG === '1')
+ console.log(usertosend)
Mutations.mutations.setServerCode(tools.CALLING)
diff --git a/src/views/login/signin/signin.ts b/src/views/login/signin/signin.ts
index 43aa868..3028988 100644
--- a/src/views/login/signin/signin.ts
+++ b/src/views/login/signin/signin.ts
@@ -147,11 +147,16 @@ export default class Signin extends Vue {
return
}
- this.$q.loading.show({ message: this.$t('login.incorso') })
+ let msg = this.$t('login.incorso')
+ if (process.env.DEBUG)
+ msg += ' ' + process.env.MONGODB_HOST
+ this.$q.loading.show({ message: msg})
// disable Button Login:
this.iswaitingforRes = true
- console.log(this.signin)
+ if (process.env.DEBUG)
+ console.log('this.signin', this.signin)
+
UserStore.actions.signin(this.signin)
.then((riscode) => {
// console.log('signin FINITO CALL: riscode=', riscode)
diff --git a/tsconfig.json b/tsconfig.json
index 829275f..145a20a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -25,10 +25,10 @@
"paths": {
"@src/*": ["./*"],
"@components": ["./components/index.ts"],
- "@css/*": ["./assets/css/*"],
+ "@css/*": ["./statics/css/*"],
"@icons/*": ["./statics/icons/*"],
- "@images/*": ["./assets/images/*"],
- "@js/*": ["./assets/js/*"],
+ "@images/*": ["./statics/images/*"],
+ "@js/*": ["./statics/js/*"],
"@classes": ["./classes/index.ts"],
"@utils/*": ["./utils/*"],
"@validators": ["./utils/validators.ts"],
diff --git a/yarn.lock b/yarn.lock
index 3afa1a7..223b6bb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -10189,9 +10189,9 @@ optimist@^0.6.1:
minimist "~0.0.1"
wordwrap "~0.0.2"
-optimize-css-assets-webpack-plugin@5.0.1:
+optimize-css-statics-webpack-plugin@5.0.1:
version "5.0.1"
- resolved "https://registry.yarnpkg.com/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-5.0.1.tgz#9eb500711d35165b45e7fd60ba2df40cb3eb9159"
+ resolved "https://registry.yarnpkg.com/optimize-css-statics-webpack-plugin/-/optimize-css-statics-webpack-plugin-5.0.1.tgz#9eb500711d35165b45e7fd60ba2df40cb3eb9159"
integrity sha512-Rqm6sSjWtx9FchdP0uzTQDc7GXDKnwVEGoSxjezPkzMewx7gEWE9IMUYKmigTRC4U3RaNSwYVnUDLuIdtTpm0A==
dependencies:
cssnano "^4.1.0"
@@ -11751,7 +11751,7 @@ quasar-cli@^0.17.23:
net "1.0.2"
node-loader "0.6.0"
opn "5.3.0"
- optimize-css-assets-webpack-plugin "5.0.1"
+ optimize-css-statics-webpack-plugin "5.0.1"
ouch "2.0.0"
postcss-loader "3.0.0"
postcss-rtl "1.3.2"