Show Button, when Upgrade Version is available ! (check from the server, the version number
- for debug: added led button to see when is calling the server and the IndexedDb.
This commit is contained in:
@@ -1,7 +1,24 @@
|
||||
import indexdb from './indexdb'
|
||||
import { GlobalStore } from "../store/Modules";
|
||||
|
||||
export default async (context, cmd, table, data = null, id = '') => {
|
||||
const descr = data !== null ? data.descr : ''
|
||||
// console.log('globalroutines', cmd, table, descr, id)
|
||||
return await indexdb(context, cmd, table, data, id)
|
||||
.then(ris => {
|
||||
setTimeout(function () {
|
||||
GlobalStore.state.connData.uploading_indexeddb = 0
|
||||
GlobalStore.state.connData.downloading_indexeddb = 0
|
||||
}, 1000)
|
||||
return ris
|
||||
}
|
||||
|
||||
).catch(err => {
|
||||
setTimeout(function () {
|
||||
GlobalStore.state.connData.uploading_indexeddb = (GlobalStore.state.connData.uploading_indexeddb === 1) ? -1 : GlobalStore.state.connData.uploading_indexeddb
|
||||
GlobalStore.state.connData.downloading_indexeddb = (GlobalStore.state.connData.downloading_indexeddb === 1) ? -1 : GlobalStore.state.connData.downloading_indexeddb
|
||||
}, 1000)
|
||||
|
||||
console.log('ERROR INDEXEDDB: ', err)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -57,23 +57,35 @@ function testfunc2 () {
|
||||
}
|
||||
|
||||
export default async (context, cmd, table, datakey = null, id = '') => {
|
||||
|
||||
// console.log('TABLE', table, 'cmd', cmd)
|
||||
if (cmd === 'loadapp') {
|
||||
// ****** LOAD APP AL CARICAMENTO ! *******
|
||||
return saveConfigIndexDb(context, datakey)
|
||||
|
||||
} else if (cmd === 'write') {
|
||||
if (GlobalStore)
|
||||
GlobalStore.state.connData.uploading_indexeddb = 1
|
||||
return await storage.setdata(table, datakey)
|
||||
} else if (cmd === 'updatefromIndexedDbToStateTodo') {
|
||||
return await readfromIndexDbToStateTodos(context, table)
|
||||
} else if (cmd === 'readall') {
|
||||
if (GlobalStore)
|
||||
GlobalStore.state.connData.downloading_indexeddb = 1
|
||||
return await storage.getalldata(table)
|
||||
} else if (cmd === 'count') {
|
||||
return await storage.count(table)
|
||||
} else if (cmd === 'read') {
|
||||
if (GlobalStore)
|
||||
GlobalStore.state.connData.downloading_indexeddb = 1
|
||||
return await storage.getdata(table, id)
|
||||
} else if (cmd === 'delete') {
|
||||
if (GlobalStore)
|
||||
GlobalStore.state.connData.uploading_indexeddb = 1
|
||||
return await storage.deletedata(table, id)
|
||||
} else if (cmd === 'clearalldata') {
|
||||
if (GlobalStore)
|
||||
GlobalStore.state.connData.uploading_indexeddb = 1
|
||||
return await storage.clearalldata(table)
|
||||
} else if (cmd === 'log') {
|
||||
consolelogpao(table)
|
||||
|
||||
Reference in New Issue
Block a user