From 15d4cb49dff0629a3a0e6b61219dfffd23445e9d Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 22 Oct 2023 15:13:50 +0800 Subject: [PATCH] fix: notification count still displays when closing alert #51 --- src/components/Topbar/Topbar.vue | 6 ++---- src/components/Topbar/components/NotificationsPop.vue | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/Topbar/Topbar.vue b/src/components/Topbar/Topbar.vue index 537355cf..a0211061 100644 --- a/src/components/Topbar/Topbar.vue +++ b/src/components/Topbar/Topbar.vue @@ -36,7 +36,7 @@ const isLogin = ref(false) const unReadMessage = reactive( {}, ) as UnwrapNestedRefs -const unReadDm = reactive({} as UnwrapNestedRefs) +const unReadDm = reactive({} as UnwrapNestedRefs) const unReadMessageCount = ref(0) const newMomentsCount = ref(0) @@ -162,9 +162,7 @@ async function getUnreadMessageCount() { }) if (res.code === 0) { Object.assign(unReadDm, res.data) - Object.entries(unReadDm).forEach(([, value]) => { - unReadMessageCount.value += typeof value === 'number' ? value : 0 - }) + unReadMessageCount.value += unReadDm.follow_unread } } catch (error) { diff --git a/src/components/Topbar/components/NotificationsPop.vue b/src/components/Topbar/components/NotificationsPop.vue index 9eeeb7fc..87391246 100644 --- a/src/components/Topbar/components/NotificationsPop.vue +++ b/src/components/Topbar/components/NotificationsPop.vue @@ -61,7 +61,7 @@ export default defineComponent({ }).then((res) => { if (res.code === 0) { const resData = res.data - this.list[4].unreadCount = parseInt(resData.unfollow_unread) + parseInt(resData.follow_unread) + this.list[4].unreadCount = resData.follow_unread } }).catch(() => { this.list[4].unreadCount = 0