fix Saldo when press refuse coins.
fix Risolvere problema del ritardo quando si fa il primo login...
This commit is contained in:
@@ -12,6 +12,7 @@ import { tools } from '@src/store/Modules/tools'
|
||||
import { useRouter } from 'vue-router'
|
||||
import MixinUsers from '../../../mixins/mixin-users'
|
||||
import { useNotifStore } from '@store/NotifStore'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
|
||||
import { CTitleBanner } from '@/components/CTitleBanner'
|
||||
@@ -38,6 +39,7 @@ export default defineComponent({
|
||||
const $router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const notifStore = useNotifStore()
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
const { t } = useI18n()
|
||||
const q = useQuasar()
|
||||
@@ -51,9 +53,7 @@ export default defineComponent({
|
||||
|
||||
const lasts_notifs = computed(() => notifStore.getlasts_notifs().filter((rec) => show_all.value ? true : !rec.read))
|
||||
const num_notifs_unread = computed(() => notifStore.getnumNotifUnread())
|
||||
const usernotifs = computed(() => userStore.my.profile.notifs)
|
||||
|
||||
const userId = ref('')
|
||||
// const usernotifs = computed(() => userStore.my.profile.notifs)
|
||||
|
||||
const polling = ref(<any> null)
|
||||
const eseguipolling = ref(true)
|
||||
@@ -89,10 +89,10 @@ export default defineComponent({
|
||||
console.log('checkifpolling')
|
||||
if (eseguipolling.value) {
|
||||
if (!polling.value) {
|
||||
console.log('esegui POLLING....')
|
||||
console.log('esegui POLLING 2....')
|
||||
polling.value = setInterval(() => {
|
||||
checkIfArrivedSomeNotif()
|
||||
}, 3000)
|
||||
}, 2000)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,19 +103,17 @@ export default defineComponent({
|
||||
clearInterval(polling.value)
|
||||
}
|
||||
|
||||
/*
|
||||
watch(() => usernotifs.value, async (to: any, from: any) => {
|
||||
|
||||
if (usernotifs.value) {
|
||||
console.log('usernotifs.value', usernotifs.value, to)
|
||||
const ret = await userStore.setUserNotifs(usernotifs.value)
|
||||
/*if (ret) {
|
||||
tools.showPositiveNotif(q, t('db.recupdated'))
|
||||
} else {
|
||||
tools.showNegativeNotif(q, t('db.recfailed'))
|
||||
}*/
|
||||
}
|
||||
})
|
||||
|
||||
*/
|
||||
|
||||
watch(() => userStore.my.username, async (to: any, from: any) => {
|
||||
if (userStore.my.username) {
|
||||
await refreshdata(userStore.my.username)
|
||||
@@ -163,31 +161,38 @@ export default defineComponent({
|
||||
|
||||
|
||||
async function refreshdata(username: string) {
|
||||
console.log('refreshdata')
|
||||
loading.value = true
|
||||
userId.value = userStore.my._id
|
||||
try {
|
||||
if (globalStore.finishLoading) {
|
||||
|
||||
notifsel.value.dest = ''
|
||||
|
||||
if (!!username) {
|
||||
if (!!username) {
|
||||
notifsel.value.dest = ''
|
||||
console.log('refreshdata')
|
||||
loading.value = true
|
||||
|
||||
return notifStore.updateNotifDataFromServer({
|
||||
username,
|
||||
lastdataread: getlastdataread(username)
|
||||
}).then((ris) => {
|
||||
return notifStore.updateNotifDataFromServer({
|
||||
username,
|
||||
lastdataread: getlastdataread(username)
|
||||
}).then((ris) => {
|
||||
|
||||
notifStore.updateNotification = false
|
||||
notifsel.value.dest = username
|
||||
loading.value = false
|
||||
notifStore.updateNotification = false
|
||||
notifsel.value.dest = username
|
||||
loading.value = false
|
||||
|
||||
const element = document.getElementById('last')
|
||||
tools.scrollToElement(element)
|
||||
const element = document.getElementById('last')
|
||||
tools.scrollToElement(element)
|
||||
|
||||
// changemsgs('', '')
|
||||
// changemsgs('', '')
|
||||
|
||||
}).catch((err) => {
|
||||
loading.value = false
|
||||
})
|
||||
}).catch((err) => {
|
||||
console.error(' refreshdata', err)
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(' refreshdata', e)
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,9 +216,7 @@ export default defineComponent({
|
||||
getTypeDirNotif,
|
||||
getTypeIdNotif,
|
||||
tools,
|
||||
usernotifs,
|
||||
shared_consts,
|
||||
userId,
|
||||
myuser,
|
||||
costanti,
|
||||
open,
|
||||
|
||||
Reference in New Issue
Block a user