Conto Comunitario all'interno di un Circuito

This commit is contained in:
Surya Paolo
2023-01-21 19:02:26 +01:00
parent 42d68eb4b8
commit 98c0218ef7
18 changed files with 117 additions and 42 deletions

View File

@@ -32,7 +32,7 @@ export const useNotifStore = defineStore('NotifStore', {
},
getnotifs_coinsreq: (mystate: INotifState) => (): INotif[] => {
const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 20).filter((rec) => rec.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS && rec.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ && rec.status === 0) : []
const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 20).filter((rec) => rec.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS && rec.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ && rec.status === shared_consts.CircuitsNotif.STATUS_NONE) : []
return (ctrec)
},
@@ -84,6 +84,13 @@ export const useNotifStore = defineStore('NotifStore', {
}
}
},
updateArrRecNotifFromServer(arrrecnotif: INotif[]) {
if (arrrecnotif && arrrecnotif.length > 0) {
this.last_notifs = arrrecnotif
this.updateArrNotif()
}
},
async setBadgeIconApp() {
// Get our dummy count and update it,
@@ -244,6 +251,30 @@ export const useNotifStore = defineStore('NotifStore', {
setCountNotifs(num: number) {
this.countNotif = num
},
getLastNotif(username: string): any {
// Get msg for this chat
if (this.last_notifs)
return this.last_notifs.find((rec: INotif) => rec.dest === username)
// return users_msg_saved[username]
},
getLastDataRead(username: string): any {
// Get msg for this
let myrec = this.getLastNotif(username)
const lastdata: any = (myrec && myrec.lastdataread) ? myrec.lastdataread : tools.getLastDateReadReset()
let mydate = ''
if (!tools.isIsoDate(lastdata))
mydate = lastdata.toISOString()
else
return lastdata
return mydate
}
},
})