- fix notifiche
This commit is contained in:
@@ -16,6 +16,7 @@ export const shared_consts = {
|
||||
},
|
||||
},
|
||||
LIMIT_NOTIF_FOR_USER: 200,
|
||||
LIMIT_NOTIFCOINS_FOR_USER: 200,
|
||||
|
||||
PROD: {
|
||||
TUTTI: 0,
|
||||
|
||||
@@ -144,7 +144,6 @@ export default defineComponent({
|
||||
return notifStore.updateNotifDataFromServer({
|
||||
username,
|
||||
lastdataread: getlastdataread(username),
|
||||
qualinotif: shared_consts.QualiNotifs.CIRCUITS
|
||||
}).then((ris) => {
|
||||
|
||||
notifStore.updateNotification = false
|
||||
|
||||
@@ -77,17 +77,16 @@
|
||||
|
||||
<div class="clBorderSperator"></div>
|
||||
|
||||
<div class="q-ma-xs">
|
||||
<div class="q-ma-xs text-black">
|
||||
<q-list bordered class="rounded-borders">
|
||||
|
||||
<div v-if="num_notifs_unread === 0">
|
||||
<q-item>
|
||||
<q-item-label lines="1">{{ $t('notifs.nocoins') }}</q-item-label>
|
||||
<q-item-label lines="1" class="text-gray">{{ $t('notifs.nocoins') }}</q-item-label>
|
||||
|
||||
</q-item>
|
||||
</div>
|
||||
|
||||
|
||||
<q-item clickable v-for="(notif, index) in getlasts_coins" :key="index">
|
||||
|
||||
<!--<q-item-section avatar>
|
||||
|
||||
@@ -180,7 +180,6 @@ export default defineComponent({
|
||||
return notifStore.updateNotifDataFromServer({
|
||||
username: myusername,
|
||||
lastdataread: getlastdataread(myusername),
|
||||
qualinotif: shared_consts.QualiNotifs.OTHERS
|
||||
}).then((ris) => {
|
||||
|
||||
notifStore.updateNotification = false
|
||||
|
||||
@@ -136,8 +136,14 @@ export const useNotifStore = defineStore('NotifStore', {
|
||||
// console.log('res', res)
|
||||
setTimeout(() => {
|
||||
if (res) {
|
||||
for (const rec of this.last_notifs) {
|
||||
rec.read = true
|
||||
if (qualinotif === shared_consts.QualiNotifs.CIRCUITS) {
|
||||
for (const rec of this.last_notifcoins) {
|
||||
rec.read = true
|
||||
}
|
||||
} else {
|
||||
for (const rec of this.last_notifs) {
|
||||
rec.read = true
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updateArrNotif()
|
||||
@@ -160,7 +166,7 @@ export const useNotifStore = defineStore('NotifStore', {
|
||||
rec = this.last_notifs.find((rec: any) => rec._id === _id)
|
||||
else
|
||||
rec = this.last_notifcoins.find((rec: any) => rec._id === _id)
|
||||
|
||||
|
||||
if (rec) {
|
||||
rec.read = true
|
||||
}
|
||||
@@ -218,22 +224,21 @@ export const useNotifStore = defineStore('NotifStore', {
|
||||
return ''
|
||||
},
|
||||
|
||||
async updateNotifDataFromServer({ username, lastdataread, qualinotif }: { username: string, lastdataread: Date, qualinotif: number }) {
|
||||
async updateNotifDataFromServer({ username, lastdataread }: { username: string, lastdataread: Date }) {
|
||||
// console.log('updateNotifDataFromServer', username, lastdataread)
|
||||
|
||||
return Api.SendReq(`/sendnotif/${username}/${lastdataread}/${process.env.APP_ID}/${qualinotif}`, 'GET', null)
|
||||
return Api.SendReq(`/sendnotif/${username}/${lastdataread}/${process.env.APP_ID}`, 'GET', null)
|
||||
.then((res) => {
|
||||
// console.log('res', res)
|
||||
if (!!res.data && !!res.data.arrnotif) {
|
||||
if (qualinotif === shared_consts.QualiNotifs.CIRCUITS)
|
||||
this.last_notifcoins = res.data.arrnotif
|
||||
else
|
||||
if (!!res.data) {
|
||||
if (!!res.data.arrnotif)
|
||||
this.last_notifs = res.data.arrnotif
|
||||
} else {
|
||||
if (qualinotif === shared_consts.QualiNotifs.CIRCUITS)
|
||||
this.last_notifcoins = []
|
||||
else
|
||||
this.last_notifs = []
|
||||
if (!!res.data.arrnotifcoins)
|
||||
this.last_notifcoins = res.data.arrnotifcoins
|
||||
else
|
||||
this.last_notifcoins = []
|
||||
}
|
||||
this.updateArrNotif()
|
||||
tools.updateMyData(res.data.ris)
|
||||
|
||||
Reference in New Issue
Block a user