Fix: Todo Multi refresh ...
fix some promises problem
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
APP_VERSION="DEV 0.0.17"
|
APP_VERSION="DEV 0.0.27"
|
||||||
SERVICE_WORKER_FILE='service-worker.js'
|
SERVICE_WORKER_FILE='service-worker.js'
|
||||||
APP_ID='1'
|
APP_ID='1'
|
||||||
APP_URL='https://freeplanet.app'
|
APP_URL='https://freeplanet.app'
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
// Questo è il swSrc
|
// Questo è il swSrc
|
||||||
|
|
||||||
console.log(' [ VER-0.0.21 ] _---------________------ PAO: this is my custom service worker');
|
console.log(' [ VER-0.0.27 ] _---------________------ PAO: this is my custom service worker');
|
||||||
|
|
||||||
importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.0.0/workbox-sw.js'); //++Todo: Replace with local workbox.js
|
|
||||||
importScripts('../statics/js/idb.js');
|
importScripts('../statics/js/idb.js');
|
||||||
importScripts('../statics/js/storage.js');
|
importScripts('../statics/js/storage.js');
|
||||||
|
importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.0.0/workbox-sw.js'); //++Todo: Replace with local workbox.js
|
||||||
|
|
||||||
|
|
||||||
let port = 3000;
|
let port = 3000;
|
||||||
@@ -24,6 +24,9 @@ const cfgenv = {
|
|||||||
dbversion: 11,
|
dbversion: 11,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log('serverweb', cfgenv.serverweb)
|
||||||
|
|
||||||
|
|
||||||
async function writeData(table, data) {
|
async function writeData(table, data) {
|
||||||
// console.log('writeData', table, data);
|
// console.log('writeData', table, data);
|
||||||
await idbKeyval.setdata(table, data);
|
await idbKeyval.setdata(table, data);
|
||||||
@@ -54,10 +57,10 @@ async function deleteItemFromData(table, id) {
|
|||||||
|
|
||||||
if (!workbox) {
|
if (!workbox) {
|
||||||
let workbox = new self.WorkboxSW();
|
let workbox = new self.WorkboxSW();
|
||||||
// console.log('SW-06 3');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workbox) {
|
if (workbox) {
|
||||||
|
// console.log('WORKBOX PRESENT')
|
||||||
// const url = new URL(location.href);
|
// const url = new URL(location.href);
|
||||||
// const debug = url.searchParams.has('debug');
|
// const debug = url.searchParams.has('debug');
|
||||||
const debug = false;
|
const debug = false;
|
||||||
@@ -101,11 +104,12 @@ if (workbox) {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// console.log(' routing.registerRoute function declaration:')
|
||||||
|
|
||||||
workbox.routing.registerRoute(
|
workbox.routing.registerRoute(
|
||||||
new RegExp(cfgenv.serverweb + '/todos/'),
|
new RegExp(cfgenv.serverweb + '/todos/'),
|
||||||
function (args) {
|
function (args) {
|
||||||
// console.log('registerRoute!')
|
console.log('registerRoute! ', cfgenv.serverweb + '/todos/')
|
||||||
// console.log('DATABODY:', args.event.request.body)
|
// console.log('DATABODY:', args.event.request.body)
|
||||||
let myres = null
|
let myres = null
|
||||||
// return fetch(args.event.request, args.event.headers)
|
// return fetch(args.event.request, args.event.headers)
|
||||||
@@ -117,8 +121,11 @@ if (workbox) {
|
|||||||
// console.log('res.status', res.status)
|
// console.log('res.status', res.status)
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const clonedRes = res.clone();
|
const clonedRes = res.clone();
|
||||||
clearAllData('todos')
|
|
||||||
|
return clearAllData('todos')
|
||||||
|
.then(() => {
|
||||||
return clonedRes
|
return clonedRes
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((clonedRes) => {
|
.then((clonedRes) => {
|
||||||
@@ -126,12 +133,12 @@ if (workbox) {
|
|||||||
return clonedRes.json();
|
return clonedRes.json();
|
||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(async data => {
|
||||||
if (data) {
|
if (data) {
|
||||||
if (data.todos) {
|
if (data.todos) {
|
||||||
console.log('Records TODOS Received from Server [', data.todos.length, 'record]', data.todos)
|
console.log('***********************+++++++++++++++++++++++++++++++++++++++++++++++++++********** Records TODOS Received from Server [', data.todos.length, 'record]', data.todos)
|
||||||
for (let key in data.todos) {
|
for (const key in data.todos) {
|
||||||
writeData('todos', data.todos[key])
|
await writeData('todos', data.todos[key])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -483,8 +490,14 @@ self.addEventListener('push', function (event) {
|
|||||||
|
|
||||||
var data = { title: 'New!', content: 'Something new happened!', url: '/' };
|
var data = { title: 'New!', content: 'Something new happened!', url: '/' };
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
if (event.data) {
|
if (event.data) {
|
||||||
|
try {
|
||||||
data = JSON.parse(event.data.text());
|
data = JSON.parse(event.data.text());
|
||||||
|
} catch (e) {
|
||||||
|
data = event.data.text();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
@@ -499,5 +512,8 @@ self.addEventListener('push', function (event) {
|
|||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
self.registration.showNotification(data.title, options)
|
self.registration.showNotification(data.title, options)
|
||||||
);
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Error on event push:', e)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
17
src/App.ts
17
src/App.ts
@@ -12,7 +12,6 @@ import globalroutines from './globalroutines/index'
|
|||||||
import { GlobalStore } from './store/Modules'
|
import { GlobalStore } from './store/Modules'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
appHeader: Header
|
appHeader: Header
|
||||||
@@ -25,6 +24,7 @@ export default class App extends Vue {
|
|||||||
public backgroundColor = 'whitesmoke'
|
public backgroundColor = 'whitesmoke'
|
||||||
public $q
|
public $q
|
||||||
|
|
||||||
|
public listaRoutingNoLogin = ['/vreg?', '/offline']
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
if (process.env.DEV) {
|
if (process.env.DEV) {
|
||||||
@@ -36,6 +36,19 @@ export default class App extends Vue {
|
|||||||
// console.info(process.env)
|
// console.info(process.env)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make autologin only if some routing
|
||||||
|
|
||||||
|
// console.log('window.location.href', window.location.href)
|
||||||
|
|
||||||
|
let chiamaautologin = true
|
||||||
|
this.listaRoutingNoLogin.forEach(mystr => {
|
||||||
|
if (window.location.href.includes(mystr)) {
|
||||||
|
chiamaautologin = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (chiamaautologin) {
|
||||||
|
console.log('CHIAMA autologin_FromLocalStorage')
|
||||||
UserStore.actions.autologin_FromLocalStorage()
|
UserStore.actions.autologin_FromLocalStorage()
|
||||||
.then((loadstorage) => {
|
.then((loadstorage) => {
|
||||||
if (loadstorage) {
|
if (loadstorage) {
|
||||||
@@ -46,6 +59,7 @@ export default class App extends Vue {
|
|||||||
GlobalStore.actions.createPushSubscription()
|
GlobalStore.actions.createPushSubscription()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Calling the Server for updates ?
|
// Calling the Server for updates ?
|
||||||
// Check the verified_email
|
// Check the verified_email
|
||||||
@@ -53,5 +67,4 @@ export default class App extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,11 +111,11 @@
|
|||||||
|
|
||||||
this.strConn = value
|
this.strConn = value
|
||||||
|
|
||||||
this.$q.notify({
|
// this.$q.notify({
|
||||||
color : 'primary',
|
// color : 'primary',
|
||||||
icon: 'wifi',
|
// icon: 'wifi',
|
||||||
message: "CAMBIATOO! " + value
|
// message: "CAMBIATOO! " + value
|
||||||
})
|
// })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
changeconn_changed(value: string, oldValue: string) {
|
changeconn_changed(value: string, oldValue: string) {
|
||||||
if (value != oldValue) {
|
if (value != oldValue) {
|
||||||
|
|
||||||
console.log('SSSSSSSS: ', value, oldValue)
|
// console.log('SSSSSSSS: ', value, oldValue)
|
||||||
|
|
||||||
const color = (value === 'online') ? 'positive' : 'warning'
|
const color = (value === 'online') ? 'positive' : 'warning'
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,10 @@ $heightitem: 19px;
|
|||||||
padding: 0px;
|
padding: 0px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
display: block;
|
||||||
|
@media screen and (min-width: 600px) {
|
||||||
display: none;
|
display: none;
|
||||||
|
}
|
||||||
color: #777;
|
color: #777;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
//visibility: hidden;
|
//visibility: hidden;
|
||||||
@@ -291,6 +294,7 @@ $heightitem: 19px;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
.container {
|
.container {
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
|
|||||||
@@ -266,9 +266,9 @@ export default class SingleTodo extends Vue {
|
|||||||
*/
|
*/
|
||||||
if (((e.keyCode === 8) || (e.keyCode === 46)) && (this.precDescr === '') && !e.shiftKey) {
|
if (((e.keyCode === 8) || (e.keyCode === 46)) && (this.precDescr === '') && !e.shiftKey) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
this.deselectRiga()
|
||||||
this.clickMenu(rescodes.MenuAction.DELETE)
|
this.clickMenu(rescodes.MenuAction.DELETE)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.deselectRiga()
|
|
||||||
this.faiFocus('insertTask', true)
|
this.faiFocus('insertTask', true)
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
@@ -356,13 +356,13 @@ export default class SingleTodo extends Vue {
|
|||||||
async clickMenu(action) {
|
async clickMenu(action) {
|
||||||
console.log('click menu: ', action)
|
console.log('click menu: ', action)
|
||||||
if (action === rescodes.MenuAction.DELETE) {
|
if (action === rescodes.MenuAction.DELETE) {
|
||||||
return this.askConfirmDelete()
|
return await this.askConfirmDelete()
|
||||||
} else if (action === rescodes.MenuAction.TOGGLE_EXPIRING) {
|
} else if (action === rescodes.MenuAction.TOGGLE_EXPIRING) {
|
||||||
return this.enableExpiring()
|
return await this.enableExpiring()
|
||||||
} else if (action === rescodes.MenuAction.COMPLETED) {
|
} else if (action === rescodes.MenuAction.COMPLETED) {
|
||||||
return this.setCompleted()
|
return await this.setCompleted()
|
||||||
} else if (action === rescodes.MenuAction.PROGRESS_BAR) {
|
} else if (action === rescodes.MenuAction.PROGRESS_BAR) {
|
||||||
return this.updatedata()
|
return await this.updatedata()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,16 +4,6 @@
|
|||||||
<SubMenus :menuPopupTodo="menuPopupTodo" :itemtodo="itemtodo" @clickMenu="clickMenu" @setPriority="setPriority"></SubMenus>
|
<SubMenus :menuPopupTodo="menuPopupTodo" :itemtodo="itemtodo" @clickMenu="clickMenu" @setPriority="setPriority"></SubMenus>
|
||||||
</q-context-menu>
|
</q-context-menu>
|
||||||
|
|
||||||
<div v-if="isTodo()" class="flex-item pos-item" @mouseup.left="mouseUp" @mousedown="clickRiga">
|
|
||||||
<q-btn flat
|
|
||||||
class="pos-item-popover"
|
|
||||||
icon="menu" >
|
|
||||||
<q-popover self="top right">
|
|
||||||
<SubMenus :menuPopupTodo="menuPopupTodo" :itemtodo="itemtodo" @clickMenu="clickMenu" @setPriority="setPriority"></SubMenus>
|
|
||||||
</q-popover>
|
|
||||||
|
|
||||||
</q-btn>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="isTodo()" class="flex-item completed-item">
|
<div v-if="isTodo()" class="flex-item completed-item">
|
||||||
<q-btn push flat
|
<q-btn push flat
|
||||||
@@ -59,6 +49,16 @@
|
|||||||
</q-datetime>
|
</q-datetime>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="isTodo()" class="flex-item pos-item" @mouseup.left="mouseUp" @mousedown="clickRiga">
|
||||||
|
<q-btn flat
|
||||||
|
class="pos-item-popover"
|
||||||
|
icon="menu" >
|
||||||
|
<q-popover self="top right">
|
||||||
|
<SubMenus :menuPopupTodo="menuPopupTodo" :itemtodo="itemtodo" @clickMenu="clickMenu" @setPriority="setPriority"></SubMenus>
|
||||||
|
</q-popover>
|
||||||
|
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
<!--<div class="flex-item btn-item">-->
|
<!--<div class="flex-item btn-item">-->
|
||||||
<!--{{itemtodo.expiring_at}}-->
|
<!--{{itemtodo.expiring_at}}-->
|
||||||
<!--</div>-->
|
<!--</div>-->
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import VueIdb from 'vue-idb'
|
|||||||
import globalroutines from '../../../globalroutines/index'
|
import globalroutines from '../../../globalroutines/index'
|
||||||
|
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
import Api from "@api"
|
import Api from '@api'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
||||||
@@ -43,7 +43,9 @@ export default class Todo extends Vue {
|
|||||||
itemDragEnd: any = null
|
itemDragEnd: any = null
|
||||||
selrowid: number = 0
|
selrowid: number = 0
|
||||||
polling = null
|
polling = null
|
||||||
mytypetransgroup: string = 'crossfade'
|
mytypetransgroup: string = 'flip-list'
|
||||||
|
tmpstrTodos: string = ''
|
||||||
|
loadDone: boolean = false
|
||||||
|
|
||||||
fieldtochange: String [] = ['descr', 'completed', 'category', 'expiring_at', 'priority', 'id_prev', 'id_next', 'pos', 'enableExpiring', 'progress']
|
fieldtochange: String [] = ['descr', 'completed', 'category', 'expiring_at', 'priority', 'id_prev', 'id_next', 'pos', 'enableExpiring', 'progress']
|
||||||
|
|
||||||
@@ -67,7 +69,7 @@ export default class Todo extends Vue {
|
|||||||
@Watch('$route.params.category') changecat() {
|
@Watch('$route.params.category') changecat() {
|
||||||
// console.log('changecat')
|
// console.log('changecat')
|
||||||
this.mytypetransgroup = 'nessuno'
|
this.mytypetransgroup = 'nessuno'
|
||||||
this.updatetable().then(() => {
|
this.updatetable(false, '$route.params.category').then(() => {
|
||||||
this.mytypetransgroup = 'crossfade'
|
this.mytypetransgroup = 'crossfade'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -80,23 +82,31 @@ export default class Todo extends Vue {
|
|||||||
return Todos.state.reload_fromServer
|
return Todos.state.reload_fromServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set reload_fromServer(value: number) {
|
||||||
|
Todos.state.reload_fromServer = value
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Watch('todos_changed', { immediate: true, deep: true })
|
@Watch('todos_changed', { immediate: true, deep: true })
|
||||||
changetodos_changed(value: string, oldValue: string) {
|
changetodos_changed(value: number, oldValue: number) {
|
||||||
|
|
||||||
// this.$q.notify('Changed...')
|
// this.$q.notify('Changed...')
|
||||||
|
|
||||||
console.log('Todos.state.todos_changed CHANGED!', value, oldValue)
|
if ((value > 1) && (this.loadDone)) {
|
||||||
this.updatetable(true)
|
// console.log('Todos.state.todos_changed CHANGED!', value, oldValue)
|
||||||
|
this.updatetable(true, 'todos_changed')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Watch('reload_fromServer', { immediate: true })
|
@Watch('reload_fromServer', { immediate: true })
|
||||||
reload_fromServer_changed(value: string, oldValue: string) {
|
reload_fromServer_changed(value: number, oldValue: number) {
|
||||||
console.log('reload_fromServer_changed!', value, oldValue)
|
if (value > 0) {
|
||||||
|
// console.log('reload_fromServer_changed!', value, oldValue)
|
||||||
// if (value) {
|
// if (value) {
|
||||||
Todos.actions.dbLoadTodo(false)
|
Todos.actions.dbLoadTodo(false)
|
||||||
|
|
||||||
Todos.actions.updateArrayInMemory()
|
Todos.actions.updateArrayInMemory()
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +118,37 @@ export default class Todo extends Vue {
|
|||||||
@Watch('testPao', { immediate: true, deep: true })
|
@Watch('testPao', { immediate: true, deep: true })
|
||||||
changedTestpao(value: string, oldValue: string) {
|
changedTestpao(value: string, oldValue: string) {
|
||||||
// console.log('testpao CHANGED', value, oldValue)
|
// console.log('testpao CHANGED', value, oldValue)
|
||||||
this.updatetable(true)
|
// this.updatetable(true, 'testPao')
|
||||||
|
}
|
||||||
|
|
||||||
|
getArrTodos() {
|
||||||
|
|
||||||
|
let mystr = ''
|
||||||
|
let mythis = this
|
||||||
|
|
||||||
|
mythis.tmpstrTodos = ''
|
||||||
|
globalroutines(null, 'readall', 'todos', null)
|
||||||
|
.then(function (alldata) {
|
||||||
|
const myrecs = [...alldata]
|
||||||
|
|
||||||
|
myrecs.forEach(rec => {
|
||||||
|
mystr = mystr + rec.descr + '] ['
|
||||||
|
})
|
||||||
|
|
||||||
|
mythis.tmpstrTodos = 'TODOS: ' + mystr
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
setArrTodos() {
|
||||||
|
|
||||||
|
let mystr = ''
|
||||||
|
let mythis = this
|
||||||
|
|
||||||
|
mythis.tmpstrTodos = ''
|
||||||
|
globalroutines(null, 'write', 'todos', this.todos_arr[0])
|
||||||
|
.then(function (alldata) {
|
||||||
|
mythis.getArrTodos()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
getCategory() {
|
getCategory() {
|
||||||
@@ -283,7 +323,7 @@ export default class Todo extends Vue {
|
|||||||
// Updated only elements modified
|
// Updated only elements modified
|
||||||
await this.updateModifyRecords(true)
|
await this.updateModifyRecords(true)
|
||||||
|
|
||||||
this.updatetable()
|
this.updatetable(false, 'onEnd')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +339,7 @@ export default class Todo extends Vue {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (update)
|
if (update)
|
||||||
await this.updatetable(refresh)
|
await this.updatetable(refresh, 'updateModifyRecords')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -322,6 +362,7 @@ export default class Todo extends Vue {
|
|||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
|
|
||||||
|
|
||||||
this.todos_arr = [...Todos.state.todos]
|
this.todos_arr = [...Todos.state.todos]
|
||||||
|
|
||||||
// Set last category selected
|
// Set last category selected
|
||||||
@@ -334,7 +375,7 @@ export default class Todo extends Vue {
|
|||||||
this.setarrPriority()
|
this.setarrPriority()
|
||||||
this.clearArr()
|
this.clearArr()
|
||||||
|
|
||||||
await this.updatetable()
|
await this.updatetable(false, 'load')
|
||||||
|
|
||||||
|
|
||||||
this.checkUpdate_everytime()
|
this.checkUpdate_everytime()
|
||||||
@@ -345,6 +386,7 @@ export default class Todo extends Vue {
|
|||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
this.loadDone = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call to check if need to refresh
|
// Call to check if need to refresh
|
||||||
@@ -356,8 +398,8 @@ export default class Todo extends Vue {
|
|||||||
|
|
||||||
initcat() {
|
initcat() {
|
||||||
|
|
||||||
var tomorrow = new Date();
|
let tomorrow = new Date();
|
||||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
tomorrow.setDate(tomorrow.getDate() + 1)
|
||||||
|
|
||||||
|
|
||||||
const objtodo: ITodo = {
|
const objtodo: ITodo = {
|
||||||
@@ -433,7 +475,7 @@ export default class Todo extends Vue {
|
|||||||
const rismod = await this.modify(lastelem, false)
|
const rismod = await this.modify(lastelem, false)
|
||||||
|
|
||||||
this.saveItemToSyncAndDb(rescodes.DB.TABLE_SYNC_TODOS, 'POST', objtodo, true)
|
this.saveItemToSyncAndDb(rescodes.DB.TABLE_SYNC_TODOS, 'POST', objtodo, true)
|
||||||
this.updatetable(false)
|
this.updatetable(false, 'insertTodo')
|
||||||
|
|
||||||
// console.log('ESCO.........')
|
// console.log('ESCO.........')
|
||||||
|
|
||||||
@@ -582,7 +624,7 @@ export default class Todo extends Vue {
|
|||||||
// Delete item
|
// Delete item
|
||||||
await globalroutines(this, 'delete', 'todos', null, id)
|
await globalroutines(this, 'delete', 'todos', null, id)
|
||||||
.then((ris) => {
|
.then((ris) => {
|
||||||
mythis.updatetable()
|
mythis.updatetable(false, 'deleteitem')
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log('err: ', error)
|
console.log('err: ', error)
|
||||||
})
|
})
|
||||||
@@ -603,8 +645,8 @@ export default class Todo extends Vue {
|
|||||||
return itemnew.pos !== itemold.pos
|
return itemnew.pos !== itemold.pos
|
||||||
}
|
}
|
||||||
|
|
||||||
async updatetable(refresh: boolean = false) {
|
async updatetable(refresh: boolean = false, strpos = '') {
|
||||||
console.log('updatetable')
|
console.log('updatetable', strpos)
|
||||||
|
|
||||||
this.prevRecords = [...this.todos_arr]
|
this.prevRecords = [...this.todos_arr]
|
||||||
|
|
||||||
@@ -808,7 +850,7 @@ export default class Todo extends Vue {
|
|||||||
// console.log('SET MODIFIED FALSE')
|
// console.log('SET MODIFIED FALSE')
|
||||||
|
|
||||||
if (update)
|
if (update)
|
||||||
this.updatetable(false)
|
this.updatetable(false, 'modify')
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -829,7 +871,7 @@ export default class Todo extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clicktest2() {
|
clicktest2() {
|
||||||
this.updatetable(false)
|
this.updatetable(false, 'clicktest')
|
||||||
console.log('Todos.state.todos', Todos.state.todos)
|
console.log('Todos.state.todos', Todos.state.todos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<div class="drag">
|
<div class="drag">
|
||||||
<draggable v-model="todos_arr" :options="{draggable:'.myitemdrag'}"
|
<draggable v-model="todos_arr" :options="{draggable:'.myitemdrag'}"
|
||||||
@start="onStart" @end="onEnd" class="dragArea">
|
@start="onStart" @end="onEnd" class="dragArea">
|
||||||
<transition-group :name="mytypetransgroup" >
|
<transition-group :name="mytypetransgroup">
|
||||||
<div :id="getmyid(mytodo._id)" :key="mytodo._id" v-for="mytodo in todos_arr" class="myitemdrag">
|
<div :id="getmyid(mytodo._id)" :key="mytodo._id" v-for="mytodo in todos_arr" class="myitemdrag">
|
||||||
|
|
||||||
<div v-if="(prior !== mytodo.priority) && !mytodo.completed" :class="getTitlePriority(mytodo.priority)">
|
<div v-if="(prior !== mytodo.priority) && !mytodo.completed" :class="getTitlePriority(mytodo.priority)">
|
||||||
@@ -35,15 +35,24 @@
|
|||||||
:after="[{icon: 'arrow_forward', content: true, handler () {}}]"
|
:after="[{icon: 'arrow_forward', content: true, handler () {}}]"
|
||||||
v-on:keyup.enter="insertTodo"/>
|
v-on:keyup.enter="insertTodo"/>
|
||||||
|
|
||||||
<q-input v-model="testPao" float-label="testPao"/>
|
<!--{{ tmpstrTodos }}-->
|
||||||
<q-input v-model="todos_changed" float-label="todos_changed"/>
|
|
||||||
<q-input v-model="reload_fromServer" float-label="reload_fromServer"/>
|
|
||||||
|
|
||||||
<div class="flex-item btn-item">
|
<!--<div class="flex-item btn-item">-->
|
||||||
<!--<q-btn class="mybtn" round color="" icon="lock" @click="clicktest()"></q-btn>-->
|
<!--<q-btn class="mybtn" round color="" icon="lock" @click="getArrTodos">Get Todo</q-btn>-->
|
||||||
<!--<q-btn class="mybtn" round color="" icon="person" @click="clicktest2()"></q-btn>-->
|
<!--<q-btn class="mybtn" round color="" icon="person" @click="setArrTodos">Set Todo</q-btn>-->
|
||||||
<q-btn class="mybtn" round color="" icon="list" @click="checkUpdate()"></q-btn>
|
<!--<q-btn class="mybtn" round color="" icon="list" @click="reload_fromServer++">Reload</q-btn>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
|
|
||||||
|
<!--<q-input v-model="testPao" float-label="testPao"/>-->
|
||||||
|
<!--<q-input v-model="todos_changed" float-label="todos_changed"/>-->
|
||||||
|
|
||||||
|
<!--<q-input v-model="reload_fromServer" float-label="reload_fromServer"/>-->
|
||||||
|
|
||||||
|
<!--<div class="flex-item btn-item">-->
|
||||||
|
<!--<!–<q-btn class="mybtn" round color="" icon="lock" @click="clicktest()"></q-btn>–>-->
|
||||||
|
<!--<!–<q-btn class="mybtn" round color="" icon="person" @click="clicktest2()"></q-btn>–>-->
|
||||||
|
<!--<q-btn class="mybtn" round color="" icon="list" @click="checkUpdate()"></q-btn>-->
|
||||||
|
<!--</div>-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</q-page>
|
</q-page>
|
||||||
|
|||||||
@@ -23,3 +23,4 @@ $positive = #21BA45
|
|||||||
$negative = #DB2828
|
$negative = #DB2828
|
||||||
$info = #31CCEC
|
$info = #31CCEC
|
||||||
$warning = #F2C037
|
$warning = #F2C037
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export interface ITodosState {
|
|||||||
networkDataReceived: boolean
|
networkDataReceived: boolean
|
||||||
todos: ITodo[]
|
todos: ITodo[]
|
||||||
todos_changed: number
|
todos_changed: number
|
||||||
reload_fromServer: boolean
|
reload_fromServer: number
|
||||||
testpao: String
|
testpao: String
|
||||||
insidePending: boolean
|
insidePending: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export interface IToken {
|
export interface IToken {
|
||||||
access: string
|
access: string
|
||||||
|
// browser: string
|
||||||
token: string
|
token: string
|
||||||
data_login: Date
|
data_login: Date
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ export default class Home extends Vue {
|
|||||||
window.addEventListener('beforeinstallprompt', function (event) {
|
window.addEventListener('beforeinstallprompt', function (event) {
|
||||||
// console.log('******************************** beforeinstallprompt fired')
|
// console.log('******************************** beforeinstallprompt fired')
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
console.log('§§§§§§§§§§§§§§§§§§§§ IMPOSTA DEFERRED PROMPT !!!!!!!!!!!!!!!!! ')
|
// console.log('§§§§§§§§§§§§§§§§§§§§ IMPOSTA DEFERRED PROMPT !!!!!!!!!!!!!!!!! ')
|
||||||
|
// #Todo++ IMPOSTA DEFERRED PROMPT
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -69,6 +70,10 @@ export default class Home extends Vue {
|
|||||||
return Notification.permission
|
return Notification.permission
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NotServiceWorker () {
|
||||||
|
return (!('serviceWorker' in navigator))
|
||||||
|
}
|
||||||
|
|
||||||
displayConfirmNotification() {
|
displayConfirmNotification() {
|
||||||
let options = null
|
let options = null
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
@@ -88,12 +93,14 @@ export default class Home extends Vue {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
navigator.serviceWorker.ready
|
navigator.serviceWorker.ready
|
||||||
.then(function (swreg) {
|
.then(function (swreg) {
|
||||||
swreg.showNotification('Successfully subscribed!', options)
|
swreg.showNotification('Successfully subscribed!', options)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
urlBase64ToUint8Array(base64String) {
|
urlBase64ToUint8Array(base64String) {
|
||||||
let padding = '='.repeat((4 - base64String.length % 4) % 4)
|
let padding = '='.repeat((4 - base64String.length % 4) % 4)
|
||||||
@@ -168,7 +175,6 @@ export default class Home extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test_fetch() {
|
test_fetch() {
|
||||||
fetch('https:/httpbin.org/post', {
|
fetch('https:/httpbin.org/post', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
<q-btn v-if="getPermission() !== 'granted'" class="enable-notifications" color="primary" rounded size="lg" icon="notifications" @click="askfornotification" :label="$t('notification.ask')"/>
|
<q-btn v-if="getPermission() !== 'granted'" class="enable-notifications" color="primary" rounded size="lg" icon="notifications" @click="askfornotification" :label="$t('notification.ask')"/>
|
||||||
<q-btn v-if="getPermission() === 'granted'" class="enable-notifications" color="primary" rounded size="lg" icon="notifications" @click="showNotificationExample" label="Send Notification"/>
|
<q-btn v-if="getPermission() === 'granted'" class="enable-notifications" color="primary" rounded size="lg" icon="notifications" @click="showNotificationExample" label="Send Notification"/>
|
||||||
<!--<q-btn v-if="getPermission() === 'granted'" class="enable-notifications" color="secondary" rounded size="lg" icon="notifications" @click="createPushSubscription" label="Create Push Subscription !"/>-->
|
<!--<q-btn v-if="getPermission() === 'granted'" class="enable-notifications" color="secondary" rounded size="lg" icon="notifications" @click="createPushSubscription" label="Create Push Subscription !"/>-->
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<div>
|
<div>
|
||||||
<q-chip square color="secondary">
|
<q-chip square color="secondary">
|
||||||
@@ -16,6 +18,12 @@
|
|||||||
:label="$t('notification.titlegranted')"
|
:label="$t('notification.titlegranted')"
|
||||||
helper="Stato Notifiche">
|
helper="Stato Notifiche">
|
||||||
</q-field>
|
</q-field>
|
||||||
|
<q-field
|
||||||
|
v-if="NotServiceWorker()"
|
||||||
|
icon="notifications"
|
||||||
|
label="Service Worker not present"
|
||||||
|
>
|
||||||
|
</q-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</q-page>
|
</q-page>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const messages = {
|
|||||||
msg: {
|
msg: {
|
||||||
hello: 'Buongiorno',
|
hello: 'Buongiorno',
|
||||||
myAppName: 'FreePlanet',
|
myAppName: 'FreePlanet',
|
||||||
myDescriz: 'La prima App Libera'
|
myDescriz: ''
|
||||||
},
|
},
|
||||||
pages: {
|
pages: {
|
||||||
home: 'Principale',
|
home: 'Principale',
|
||||||
@@ -143,7 +143,7 @@ const messages = {
|
|||||||
msg: {
|
msg: {
|
||||||
hello: 'Buenos Días',
|
hello: 'Buenos Días',
|
||||||
myAppName: 'FreePlanet',
|
myAppName: 'FreePlanet',
|
||||||
myDescriz: 'La primera App Libera'
|
myDescriz: ''
|
||||||
},
|
},
|
||||||
pages: {
|
pages: {
|
||||||
home: 'Principal',
|
home: 'Principal',
|
||||||
@@ -269,7 +269,7 @@ const messages = {
|
|||||||
msg: {
|
msg: {
|
||||||
hello: 'Hello!',
|
hello: 'Hello!',
|
||||||
myAppName: 'FreePlanet',
|
myAppName: 'FreePlanet',
|
||||||
myDescriz: 'The first Free app'
|
myDescriz: ''
|
||||||
},
|
},
|
||||||
pages: {
|
pages: {
|
||||||
home: 'Dashboard One',
|
home: 'Dashboard One',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
let idbKeyval = (() => {
|
let idbKeyval = (() => {
|
||||||
let db;
|
let db;
|
||||||
|
// console.log('idbKeyval...')
|
||||||
|
|
||||||
function getDB() {
|
function getDB() {
|
||||||
if (!db) {
|
if (!db) {
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ export namespace ApiTool {
|
|||||||
let lettoqualcosa = false
|
let lettoqualcosa = false
|
||||||
|
|
||||||
// console.log('A1) INIZIO.............................................................')
|
// console.log('A1) INIZIO.............................................................')
|
||||||
globalroutines(null, 'readall', table, null)
|
return globalroutines(null, 'readall', table, null)
|
||||||
.then(function (alldata) {
|
.then(function (alldata) {
|
||||||
const myrecs = [...alldata]
|
const myrecs = [...alldata]
|
||||||
// console.log('----------------------- LEGGO QUALCOSA ')
|
// console.log('----------------------- LEGGO QUALCOSA ')
|
||||||
@@ -178,11 +178,11 @@ export namespace ApiTool {
|
|||||||
body: JSON.stringify(rec)
|
body: JSON.stringify(rec)
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
globalroutines(null, 'delete', table, null, rec._id)
|
|
||||||
lettoqualcosa = true
|
lettoqualcosa = true
|
||||||
|
return globalroutines(null, 'delete', table, null, rec._id)
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
globalroutines(null, 'delete', 'swmsg', null, mystrparam)
|
return globalroutines(null, 'delete', 'swmsg', null, mystrparam)
|
||||||
})
|
})
|
||||||
.catch(function (err) {
|
.catch(function (err) {
|
||||||
if (err.message === 'Failed to fetch') {
|
if (err.message === 'Failed to fetch') {
|
||||||
@@ -206,8 +206,8 @@ export namespace ApiTool {
|
|||||||
.then((errorfromserver) => {
|
.then((errorfromserver) => {
|
||||||
// console.log('¨¨¨¨¨¨¨¨¨¨¨¨¨¨ errorfromserver:', errorfromserver)
|
// console.log('¨¨¨¨¨¨¨¨¨¨¨¨¨¨ errorfromserver:', errorfromserver)
|
||||||
const mystate = errorfromserver ? 'offline' : 'online'
|
const mystate = errorfromserver ? 'offline' : 'online'
|
||||||
globalroutines(null, 'write', 'config', { _id: 2, stateconn: mystate })
|
|
||||||
GlobalStore.mutations.setStateConnection(mystate)
|
GlobalStore.mutations.setStateConnection(mystate)
|
||||||
|
return globalroutines(null, 'write', 'config', { _id: 2, stateconn: mystate })
|
||||||
})
|
})
|
||||||
|
|
||||||
// console.log(' [Alternative] A2) ?????????????????????????? ESCO DAL LOOP !!!!!!!!!')
|
// console.log(' [Alternative] A2) ?????????????????????????? ESCO DAL LOOP !!!!!!!!!')
|
||||||
|
|||||||
@@ -123,10 +123,10 @@ namespace Actions {
|
|||||||
function createPushSubscription(context) {
|
function createPushSubscription(context) {
|
||||||
|
|
||||||
// If Already subscribed, don't send to the Server DB
|
// If Already subscribed, don't send to the Server DB
|
||||||
if (state.wasAlreadySubOnDb) {
|
// if (state.wasAlreadySubOnDb) {
|
||||||
// console.log('wasAlreadySubOnDb!')
|
// // console.log('wasAlreadySubOnDb!')
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!('serviceWorker' in navigator)) {
|
if (!('serviceWorker' in navigator)) {
|
||||||
return
|
return
|
||||||
@@ -141,7 +141,7 @@ namespace Actions {
|
|||||||
let reg
|
let reg
|
||||||
const mykey = process.env.PUBLICKEY_PUSH
|
const mykey = process.env.PUBLICKEY_PUSH
|
||||||
const mystate = state
|
const mystate = state
|
||||||
navigator.serviceWorker.ready
|
return navigator.serviceWorker.ready
|
||||||
.then(function (swreg) {
|
.then(function (swreg) {
|
||||||
reg = swreg
|
reg = swreg
|
||||||
return swreg.pushManager.getSubscription()
|
return swreg.pushManager.getSubscription()
|
||||||
@@ -149,11 +149,13 @@ namespace Actions {
|
|||||||
.then(function (subscription) {
|
.then(function (subscription) {
|
||||||
mystate.wasAlreadySubscribed = !(subscription === null)
|
mystate.wasAlreadySubscribed = !(subscription === null)
|
||||||
|
|
||||||
if (mystate.wasAlreadySubOnDb) {
|
if (mystate.wasAlreadySubscribed) {
|
||||||
// console.log('User is already SAVED Subscribe on DB!')
|
console.log('User is already SAVED Subscribe on DB!')
|
||||||
return null
|
// return null
|
||||||
|
return subscription
|
||||||
} else {
|
} else {
|
||||||
// Create a new subscription
|
// Create a new subscription
|
||||||
|
console.log('Create a new subscription')
|
||||||
let convertedVapidPublicKey = urlBase64ToUint8Array(mykey)
|
let convertedVapidPublicKey = urlBase64ToUint8Array(mykey)
|
||||||
return reg.pushManager.subscribe({
|
return reg.pushManager.subscribe({
|
||||||
userVisibleOnly: true,
|
userVisibleOnly: true,
|
||||||
@@ -165,7 +167,7 @@ namespace Actions {
|
|||||||
saveNewSubscriptionToServer(context, newSub)
|
saveNewSubscriptionToServer(context, newSub)
|
||||||
})
|
})
|
||||||
.catch(function (err) {
|
.catch(function (err) {
|
||||||
console.log(err)
|
console.log('ERR createPushSubscription:', err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,11 +180,16 @@ namespace Actions {
|
|||||||
console.log('saveSubscriptionToServer: ', newSub)
|
console.log('saveSubscriptionToServer: ', newSub)
|
||||||
// console.log('context', context)
|
// console.log('context', context)
|
||||||
|
|
||||||
const options = {
|
let options = null
|
||||||
|
|
||||||
|
// If is not already stored in DB, then show the message to the user.
|
||||||
|
// if (!state.wasAlreadySubscribed) {
|
||||||
|
options = {
|
||||||
title: translate('notification.title_subscribed'),
|
title: translate('notification.title_subscribed'),
|
||||||
content: translate('notification.subscribed'),
|
content: translate('notification.subscribed'),
|
||||||
openUrl: '/'
|
openUrl: '/'
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
let myres = {
|
let myres = {
|
||||||
options: { ...options },
|
options: { ...options },
|
||||||
@@ -252,6 +259,7 @@ namespace Actions {
|
|||||||
globalroutines(null, 'clearalldata', table, null)
|
globalroutines(null, 'clearalldata', table, null)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
// REMOVE ALL SUBSCRIPTION
|
// REMOVE ALL SUBSCRIPTION
|
||||||
console.log('REMOVE ALL SUBSCRIPTION...')
|
console.log('REMOVE ALL SUBSCRIPTION...')
|
||||||
await navigator.serviceWorker.ready.then(function (reg) {
|
await navigator.serviceWorker.ready.then(function (reg) {
|
||||||
@@ -266,6 +274,7 @@ namespace Actions {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
await deleteSubscriptionToServer(context)
|
await deleteSubscriptionToServer(context)
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const state: ITodosState = {
|
|||||||
networkDataReceived: false,
|
networkDataReceived: false,
|
||||||
todos: [],
|
todos: [],
|
||||||
todos_changed: 1,
|
todos_changed: 1,
|
||||||
reload_fromServer: false,
|
reload_fromServer: 0,
|
||||||
testpao: 'Test',
|
testpao: 'Test',
|
||||||
insidePending: false
|
insidePending: false
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ namespace Mutations {
|
|||||||
function setTodos_changed(state: ITodosState) {
|
function setTodos_changed(state: ITodosState) {
|
||||||
state.todos_changed++
|
state.todos_changed++
|
||||||
mutations.setTestpao('Cambiato : ' + String(state.todos_changed))
|
mutations.setTestpao('Cambiato : ' + String(state.todos_changed))
|
||||||
console.log('******* state.todos_changed', state.todos_changed)
|
// console.log('******* state.todos_changed', state.todos_changed)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const mutations = {
|
export const mutations = {
|
||||||
@@ -78,10 +78,10 @@ namespace Actions {
|
|||||||
|
|
||||||
let count = await checkPendingMsg(null)
|
let count = await checkPendingMsg(null)
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
return navigator.serviceWorker.ready
|
return await navigator.serviceWorker.ready
|
||||||
.then(function (sw) {
|
.then(function (sw) {
|
||||||
|
|
||||||
globalroutines(null, 'readall', 'swmsg')
|
return globalroutines(null, 'readall', 'swmsg')
|
||||||
.then(function (arr_recmsg) {
|
.then(function (arr_recmsg) {
|
||||||
// let recclone = [...arr_recmsg]
|
// let recclone = [...arr_recmsg]
|
||||||
if (arr_recmsg.length > 0) {
|
if (arr_recmsg.length > 0) {
|
||||||
@@ -119,11 +119,11 @@ namespace Actions {
|
|||||||
.then(ris => {
|
.then(ris => {
|
||||||
if (ris) {
|
if (ris) {
|
||||||
console.log('risPending = ', ris)
|
console.log('risPending = ', ris)
|
||||||
const result = sendSwMsgIfAvailable()
|
return sendSwMsgIfAvailable()
|
||||||
.then(something => {
|
.then(something => {
|
||||||
if (something) {
|
if (something) {
|
||||||
// Refresh data
|
// Refresh data
|
||||||
waitAndRefreshData(context)
|
return waitAndRefreshData(context)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ namespace Actions {
|
|||||||
Todos.mutations.setTodos_changed()
|
Todos.mutations.setTodos_changed()
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('********** res', res, 'state.todos', state.todos, 'checkPending', checkPending)
|
console.log('********** res', 'state.todos', state.todos, 'checkPending', checkPending)
|
||||||
|
|
||||||
// After Login will store into the indexedDb...
|
// After Login will store into the indexedDb...
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ namespace Mutations {
|
|||||||
state.verified_email = data.verified_email
|
state.verified_email = data.verified_email
|
||||||
state.category = data.categorySel
|
state.category = data.categorySel
|
||||||
resetArrToken(state.tokens)
|
resetArrToken(state.tokens)
|
||||||
state.tokens.push({ access: 'auth ' + navigator.userAgent, token: state.x_auth_token, date_login: new Date() })
|
state.tokens.push({ access: 'auth', token: state.x_auth_token, date_login: new Date() })
|
||||||
// console.log('state.tokens', state.tokens)
|
// console.log('state.tokens', state.tokens)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ namespace Mutations {
|
|||||||
if (!state.tokens) {
|
if (!state.tokens) {
|
||||||
state.tokens = []
|
state.tokens = []
|
||||||
}
|
}
|
||||||
state.tokens.push({ access: 'auth ' + navigator.userAgent, token: data.x_auth_token, data_login: new Date() })
|
state.tokens.push({ access: 'auth', token: data.x_auth_token, data_login: new Date() })
|
||||||
}
|
}
|
||||||
|
|
||||||
function setServerCode(state: IUserState, num: number) {
|
function setServerCode(state: IUserState, num: number) {
|
||||||
@@ -135,7 +135,7 @@ namespace Mutations {
|
|||||||
|
|
||||||
// Take only the others access (from others Browser)
|
// Take only the others access (from others Browser)
|
||||||
return arrtokens.filter((token: IToken) => {
|
return arrtokens.filter((token: IToken) => {
|
||||||
return token.access !== 'auth ' + navigator.userAgent
|
return token.access !== 'auth'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,6 +368,7 @@ namespace Actions {
|
|||||||
|
|
||||||
let sub = null
|
let sub = null
|
||||||
|
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
sub = await navigator.serviceWorker.ready
|
sub = await navigator.serviceWorker.ready
|
||||||
.then(function (swreg) {
|
.then(function (swreg) {
|
||||||
const sub = swreg.pushManager.getSubscription()
|
const sub = swreg.pushManager.getSubscription()
|
||||||
@@ -376,6 +377,7 @@ namespace Actions {
|
|||||||
.catch(e => {
|
.catch(e => {
|
||||||
sub = null
|
sub = null
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
title: translate('notification.title_subscribed'),
|
title: translate('notification.title_subscribed'),
|
||||||
|
|||||||
@@ -148,10 +148,17 @@ export default class Signin extends Vue {
|
|||||||
.then((riscode) => {
|
.then((riscode) => {
|
||||||
if (riscode === rescodes.OK) {
|
if (riscode === rescodes.OK) {
|
||||||
GlobalStore.actions.createPushSubscription()
|
GlobalStore.actions.createPushSubscription()
|
||||||
}
|
.then(ris => {
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
console.log('ERROR = ' + e)
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
this.checkErrors(riscode)
|
this.checkErrors(riscode)
|
||||||
this.$q.loading.hide()
|
this.$q.loading.hide()
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log('ERROR = ' + error)
|
console.log('ERROR = ' + error)
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import { serv_constants } from '../../../store/Modules/serv_constants'
|
|||||||
import './vreg.css'
|
import './vreg.css'
|
||||||
import { ILinkReg } from '../../../model/other'
|
import { ILinkReg } from '../../../model/other'
|
||||||
|
|
||||||
@Component({
|
@Component({})
|
||||||
|
|
||||||
})
|
|
||||||
export default class Vreg extends Vue {
|
export default class Vreg extends Vue {
|
||||||
public risultato: string = '---'
|
public risultato: string = '---'
|
||||||
public riscode: number = 0
|
public riscode: number = 0
|
||||||
@@ -43,7 +41,8 @@ export default class Vreg extends Vue {
|
|||||||
let param: ILinkReg
|
let param: ILinkReg
|
||||||
param = { idlink: this.$route.query.idlink.toString() }
|
param = { idlink: this.$route.query.idlink.toString() }
|
||||||
console.log('idlink = ', param)
|
console.log('idlink = ', param)
|
||||||
UserStore.actions.vreg(param).then((ris) => {
|
return UserStore.actions.vreg(param)
|
||||||
|
.then((ris) => {
|
||||||
this.riscode = ris.code
|
this.riscode = ris.code
|
||||||
this.risultato = ris.msg
|
this.risultato = ris.msg
|
||||||
console.log('RIS = ')
|
console.log('RIS = ')
|
||||||
|
|||||||
Reference in New Issue
Block a user