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

@@ -310,14 +310,17 @@ export const useUserStore = defineStore('UserStore', {
IsMyCircuitByUser(user: IUserFields): any[] {
if (!this.my.profile.mycircuits || !user.profile.mycircuits)
if (!this.my.profile.mycircuits || (!user || !user.profile || !user.profile.mycircuits))
return []
return tools.getCommon([...this.my.profile.mycircuits], [...user.profile.mycircuits], 'circuitname')
},
getAccountByCircuitId(circuitId: string): any {
return this.my.profile.useraccounts.find((rec: IAccount) => rec.circuitId === circuitId)
if (this.my.profile.useraccounts) {
return this.my.profile.useraccounts.find((rec: IAccount) => rec.circuitId === circuitId)
}
return null
},
IsRefusedCircuitByName(circuitname: string): boolean {
@@ -360,7 +363,7 @@ export const useUserStore = defineStore('UserStore', {
},
isOldRegNotFinished(): boolean {
return (!this.my.profile.teleg_id || this.my.profile.teleg_id <= 0) || !this.isUsernameTelegOk()
return tools.isLogged() && ((!this.my.profile.teleg_id || this.my.profile.teleg_id <= 0) || !this.isUsernameTelegOk())
// return this.my.verified_email! && this.my.profile.teleg_id! > 0 && this.my.verified_by_aportador!
},
@@ -762,30 +765,6 @@ export const useUserStore = defineStore('UserStore', {
console.log('LOGIN signin')
const globalStore = useGlobalStore()
// console.log('MYLANG = ' + this.lang)
let sub = null
try {
if (static_data.functionality.PWA) {
if ('serviceWorker' in navigator) {
console.log('serviceWorker')
sub = await navigator.serviceWorker.ready
.then((swreg) => {
console.log('swreg')
sub = swreg.pushManager.getSubscription()
return sub
})
.catch((e) => {
console.log(' ERROR ')
sub = null
})
}
}
} catch (e) {
console.log('Err navigator.serviceWorker.ready ... GetSubscription:', e)
}
const options = {
title: tools.translate('notification.title_subscribed', [{
strin: 'sitename',
@@ -795,13 +774,10 @@ export const useUserStore = defineStore('UserStore', {
openUrl: '/',
}
console.log('2')
const usertosend = {
username: authData.username.trim(),
password: authData.password.trim(),
lang: this.lang,
subs: sub,
options,
}
@@ -813,7 +789,9 @@ export const useUserStore = defineStore('UserStore', {
let myres: any
return Api.SendReq('/users/login', 'POST', usertosend, true)
console.log('executing login...')
return await Api.SendReq('/users/login', 'POST', usertosend, true)
.then((res) => {
myres = res