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,
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
</q-item-section>
|
||||
<q-item-section>{{ $t('notifs.settings') }}</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="notifStore.setAllRead(username)">
|
||||
<q-item clickable v-close-popup @click="notifStore.setAllRead(username, shared_consts.QualiNotifs.OTHERS)">
|
||||
<q-item-section side>
|
||||
<q-icon name="fas fa-check"/>
|
||||
</q-item-section>
|
||||
<q-item-section>{{ $t('notifs.setallread') }}</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-close-popup @click="notifStore.deleteAll(username)">
|
||||
<q-item clickable v-close-popup @click="notifStore.deleteAll(username, shared_consts.QualiNotifs.OTHERS)">
|
||||
<q-item-section side>
|
||||
<q-icon name="fas fa-trash-alt"/>
|
||||
</q-item-section>
|
||||
@@ -135,51 +135,6 @@
|
||||
/>
|
||||
</div>
|
||||
</q-item-label>
|
||||
<q-item-label caption lines="2"
|
||||
v-else-if="notif.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS && notif.status === 0 && notif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_REQUEST_TO_ENTER"
|
||||
v-ripple>
|
||||
|
||||
<div class="row no-wrap justify-evenly" v-if="tools.iAmAdminCircuit(notif.extrafield)">
|
||||
<q-btn
|
||||
dense
|
||||
rounded
|
||||
size="sm"
|
||||
icon="fas fa-user-plus"
|
||||
color="positive" :label="$t('circuit.accept')"
|
||||
@click="tools.addToMyCircuits(q, notif.sender, notif.extrafield)"
|
||||
/>
|
||||
<q-btn
|
||||
dense
|
||||
rounded
|
||||
size="sm"
|
||||
icon="fas fa-user-minus"
|
||||
color="negative" :label="$t('shared.refuse_ask')"
|
||||
@click="tools.refuseReqCircuit(q, notif.sender, notif.extrafield)"
|
||||
/>
|
||||
</div>
|
||||
</q-item-label>
|
||||
<q-item-label caption lines="2"
|
||||
v-else-if="notif.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS && notif.status === 0 && notif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ" v-ripple>
|
||||
|
||||
<div class="row no-wrap justify-evenly">
|
||||
<q-btn
|
||||
dense
|
||||
rounded
|
||||
size="sm"
|
||||
icon="fas fa-user-plus"
|
||||
color="positive" :label="$t('circuit.accept_coins')"
|
||||
@click="tools.acceptCoins(q, notif.sender, notif)"
|
||||
/>
|
||||
<q-btn
|
||||
dense
|
||||
rounded
|
||||
size="sm"
|
||||
icon="fas fa-user-minus"
|
||||
color="negative" :label="$t('circuit.refuse_coins')"
|
||||
@click="tools.refuseCoins(q, notif.sender, notif)"
|
||||
/>
|
||||
</div>
|
||||
</q-item-label>
|
||||
|
||||
<q-item-label caption lines="1" :class="(!notif.read) ? 'unread-date' : 'read-date'" @click="clickNotif(notif)">
|
||||
{{ tools.timeAgo(notif.datenotif) }}
|
||||
|
||||
Reference in New Issue
Block a user