Skip to content
Snippets Groups Projects
Commit 128c1c20 authored by Jens Christian Aanestad's avatar Jens Christian Aanestad
Browse files

feat/added remove notification in navbar

parent db6731b6
Branches feat/notifications
No related tags found
1 merge request!79Feat/notifications
Pipeline #283332 passed with warnings
......@@ -38,7 +38,9 @@
</a>
<ul v-if="notificationListRef.length > 0" class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li v-for="(item, index) in notificationListRef" :key="index" >
<router-link :to="notificationPathMapper[String(item.notificationType)]" class="d-flex align-items-center">
<router-link :to="notificationPathMapper[String(item.notificationType)]"
class="d-flex align-items-center"
@click="readNotification(item)">
<div class="flex-shrink-0">
<img :src="notificationImageMapper[String(item.notificationType)]" alt="Varslingsikon" class="notification-icon">
</div>
......@@ -129,8 +131,8 @@ const notificationImageMapper: any = {
}
const notificationPathMapper: any = {
"FRIEND_REQUEST": "/profile",
"BADGE": "/friends",
"FRIEND_REQUEST": "/friends",
"BADGE": "/profile",
"COMPLETED_GOAL": "/roadmap"
}
const getNotifications = async () => {
......@@ -140,6 +142,17 @@ const getNotifications = async () => {
notificationListRef.value = []
}
}
const readNotification = async (notification: NotificationDTO) => {
try {
notification.unread = false;
await NotificationService.updateNotification({requestBody: notification});
notificationListRef.value = await NotificationService.getUnreadNotificationByUser()
} catch (error) {
notificationListRef.value = [];
}
}
function toBadges(){
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment