fix Saldo when press refuse coins.
fix Risolvere problema del ritardo quando si fa il primo login...
This commit is contained in:
@@ -20,7 +20,13 @@ export const useNotifStore = defineStore('NotifStore', {
|
||||
getters: {
|
||||
|
||||
getlasts_notifs: (mystate: INotifState) => (): INotif[] => {
|
||||
const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 20).filter((rec) => mystate.show_all ? true : !rec.read) : []
|
||||
const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 20).filter((rec) => (mystate.show_all ? true : !rec.read) && (rec.typedir !== shared_consts.TypeNotifs.TYPEDIR_CIRCUITS)) : []
|
||||
return (ctrec)
|
||||
|
||||
},
|
||||
|
||||
getlasts_coins: (mystate: INotifState) => (): INotif[] => {
|
||||
const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 20).filter((rec) => (mystate.show_all ? true : !rec.read) && (rec.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS)) : []
|
||||
return (ctrec)
|
||||
|
||||
},
|
||||
@@ -32,7 +38,12 @@ export const useNotifStore = defineStore('NotifStore', {
|
||||
},
|
||||
|
||||
getnumNotifUnread: (mystate: INotifState) => () => {
|
||||
const myarr = mystate.last_notifs.filter((notif) => !notif.read)
|
||||
const myarr = mystate.last_notifs.filter((notif) => !notif.read && (notif.typedir !== shared_consts.TypeNotifs.TYPEDIR_CIRCUITS))
|
||||
return (tools.isArray(myarr) ? myarr.length : 0)
|
||||
},
|
||||
|
||||
getnumCoinsUnread: (mystate: INotifState) => () => {
|
||||
const myarr = mystate.last_notifs.filter((notif) => !notif.read && (notif.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS))
|
||||
return (tools.isArray(myarr) ? myarr.length : 0)
|
||||
},
|
||||
|
||||
@@ -89,8 +100,8 @@ export const useNotifStore = defineStore('NotifStore', {
|
||||
}
|
||||
},
|
||||
|
||||
setAllRead(username: string) {
|
||||
return Api.SendReq(`/sendnotif/setall/${username}/${process.env.APP_ID}`, 'GET', null)
|
||||
setAllRead(username: string, qualinotif: number) {
|
||||
return Api.SendReq(`/sendnotif/setall/${username}/${qualinotif}/${process.env.APP_ID}`, 'GET', null)
|
||||
.then((res) => {
|
||||
// console.log('res', res)
|
||||
if (res) {
|
||||
@@ -124,12 +135,15 @@ export const useNotifStore = defineStore('NotifStore', {
|
||||
|
||||
},
|
||||
|
||||
deleteAll(username: string, id: string) {
|
||||
return Api.SendReq(`/sendnotif/delall/${username}/${process.env.APP_ID}`, 'GET', null)
|
||||
deleteAll(username: string, qualinotif: number) {
|
||||
return Api.SendReq(`/sendnotif/delall/${username}/${qualinotif}/${process.env.APP_ID}`, 'GET', null)
|
||||
.then((res) => {
|
||||
// console.log('res', res)
|
||||
if (res) {
|
||||
this.last_notifs = []
|
||||
if (qualinotif === shared_consts.QualiNotifs.CIRCUITS)
|
||||
this.last_notifs = this.last_notifs.filter((rec: INotif) => rec.typedir !== shared_consts.TypeNotifs.TYPEDIR_CIRCUITS)
|
||||
else if (qualinotif === shared_consts.QualiNotifs.OTHERS)
|
||||
this.last_notifs = this.last_notifs.filter((rec: INotif) => rec.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS)
|
||||
this.updateArrNotif()
|
||||
}
|
||||
|
||||
@@ -146,7 +160,7 @@ export const useNotifStore = defineStore('NotifStore', {
|
||||
},
|
||||
|
||||
async updateNotifDataFromServer({ username, lastdataread }: {username: string, lastdataread: Date}) {
|
||||
// console.log('updateNotifDataFromServer', username, lastdataread)
|
||||
console.log('updateNotifDataFromServer', username, lastdataread)
|
||||
|
||||
return Api.SendReq(`/sendnotif/${username}/${lastdataread}/${process.env.APP_ID}`, 'GET', null)
|
||||
.then((res) => {
|
||||
@@ -157,6 +171,7 @@ export const useNotifStore = defineStore('NotifStore', {
|
||||
this.last_notifs = []
|
||||
}
|
||||
this.updateArrNotif()
|
||||
tools.updateMyData(res.data)
|
||||
return true
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user