- fix notifiche
This commit is contained in:
@@ -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