Added Notifications
This commit is contained in:
@@ -21,6 +21,10 @@ const markAllRead = async (notifications: Notification[]) => {
|
||||
unread.forEach(n => n.read_at = new Date().toISOString())
|
||||
}
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:unreadCount', value: number): void
|
||||
}>()
|
||||
|
||||
watch(open, async (isOpen) => {
|
||||
if (!isOpen || notifications.value.length) return
|
||||
loading.value = true
|
||||
@@ -28,6 +32,7 @@ watch(open, async (isOpen) => {
|
||||
notifications.value = data
|
||||
loading.value = false
|
||||
await markAllRead(notifications.value)
|
||||
emit('update:unreadCount', 0) // <-- add this
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -84,7 +89,8 @@ watch(open, async (isOpen) => {
|
||||
.notif-menu {
|
||||
position: absolute;
|
||||
top: calc(100% + 0.4rem);
|
||||
right: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 320px;
|
||||
background: var(--bg);
|
||||
border: 1px solid rgba(56, 189, 248, 0.12);
|
||||
|
||||
Reference in New Issue
Block a user