Don't check unread if session doesn't exist (#2008)
This commit is contained in:
@@ -70,8 +70,12 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async checkUnread() {
|
async checkUnread() {
|
||||||
|
const agent = getAgent()
|
||||||
|
|
||||||
|
if (!agent.session) return
|
||||||
|
|
||||||
// count
|
// count
|
||||||
const res = await getAgent().listNotifications({limit: 40})
|
const res = await agent.listNotifications({limit: 40})
|
||||||
const filtered = res.data.notifications.filter(
|
const filtered = res.data.notifications.filter(
|
||||||
notif => !notif.isRead && !shouldFilterNotif(notif, moderationOpts),
|
notif => !notif.isRead && !shouldFilterNotif(notif, moderationOpts),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user