Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106-2024-07
frontend
Commits
128c1c20
Commit
128c1c20
authored
10 months ago
by
Jens Christian Aanestad
Browse files
Options
Downloads
Patches
Plain Diff
feat/added remove notification in navbar
parent
db6731b6
Branches
feat/notifications
Branches containing commit
No related tags found
1 merge request
!79
Feat/notifications
Pipeline
#283332
passed with warnings
10 months ago
Stage: install
Stage: build
Stage: test
Stage: lint
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/BaseComponents/NavBar.vue
+16
-3
16 additions, 3 deletions
src/components/BaseComponents/NavBar.vue
with
16 additions
and
3 deletions
src/components/BaseComponents/NavBar.vue
+
16
−
3
View file @
128c1c20
...
...
@@ -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
(){
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment