fix Saldo when press refuse coins.

fix Risolvere problema del ritardo quando si fa il primo login...
This commit is contained in:
Paolo Arena
2022-09-16 17:39:28 +02:00
parent a194acfc69
commit 78a79e1ad5
53 changed files with 3779 additions and 3498 deletions

View File

@@ -68,6 +68,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
leftDrawerOpen: false,
rightDrawerOpen: false,
rightNotifOpen: false,
rightCoinsOpen: false,
rightCartOpen: false,
stateConnection: stateConnDefault,
serverError: false,
@@ -606,7 +607,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
return subscription
} else {
// Create a new subscription
console.log('Create a new subscription')
console.log('#### Create a new subscription !!!')
const convertedVapidPublicKey = urlBase64ToUint8Array(mykey)
return reg.pushManager.subscribe({
userVisibleOnly: true,
@@ -696,7 +697,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
for (const table of ApiTables.allTables()) {
await globalroutines('clearalldata', table, null)
}
}catch (e) {
} catch (e) {
//
}
@@ -704,20 +705,23 @@ export const useGlobalStore = defineStore('GlobalStore', {
if ('serviceWorker' in navigator) {
// REMOVE ALL SUBSCRIPTION
console.log('REMOVE ALL SUBSCRIPTION...')
await navigator.serviceWorker.ready.then((reg) => {
console.log('... Ready')
reg.pushManager.getSubscription().then((subscription) => {
console.log(' Found Subscription...')
if (subscription) {
subscription.unsubscribe().then((successful) => {
// You've successfully unsubscribed
console.log('You\'ve successfully unsubscribed')
}).catch((e) => {
// Unsubscription failed
})
}
navigator.serviceWorker.ready
.then((reg) => {
console.log('... Ready')
reg.pushManager.getSubscription().then((subscription) => {
console.log(' Found Subscription...')
if (subscription) {
subscription.unsubscribe().then((successful) => {
// You've successfully unsubscribed
console.log('You\'ve successfully unsubscribed')
}).catch((e) => {
// Unsubscription failed
})
}
})
}).catch((err) => {
console.error('err ready service worker', err)
})
})
}
}
@@ -818,7 +822,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
.then((res) => {
this.serverError = false
// if (tools.isDebug())
// console.table(res)
// console.table(res)
return res.data
})
.catch((error) => {
@@ -968,7 +972,14 @@ export const useGlobalStore = defineStore('GlobalStore', {
},
isErroreDispositivoServer() {
return this.serverMsgError.code === -2
if (this.serverMsgError) {
if (this.serverMsgError.code)
return this.serverMsgError.code === -2
} else {
return false
}
return false
},
async saveSubRec(mydata: any) {
@@ -1645,7 +1656,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
if (table === toolsext.TABMYGOODS) {
obj['idSectorGood'] = []
} else if ((table === toolsext.TABMYSKILLS) ) {
} else if ((table === toolsext.TABMYSKILLS)) {
obj['idSector'] = []
}
@@ -1684,10 +1695,10 @@ export const useGlobalStore = defineStore('GlobalStore', {
getServerHost() {
let myserv = ''
myserv = window.location.host
// myserv = window.location.host
if (process.env.DEBUGGING) {
myserv = 'http://localhost:3000'; // 'http://192.168.1.54:3000'
myserv = process.env.MONGODB_HOST! // 'http://192.168.1.54:3000'
} else {
myserv = process.env.MONGODB_HOST!
}