2626 'word-break': true,
2727 'border-b': true,
2828 'font-bold': !notification.is_seen,}"
29- v-for =" (notification, index) in notifications" :key =" index" >
29+ v-for =" (notification, index) in notifications" :key =" index + notification.is_seen.toString() " >
3030 <router-link
31- v-bind:to =" notification.link_to"
31+ v-bind:to =" getRouterLink( notification.link_to) "
3232 class =" py-4 flex items-center word-break cursor-pointer" >
3333 <img v-bind:src =" getImage(notification.type)" class =" w-4 h-4" >
3434 <h1 class =" ml-4" >{{notification.content}}</h1 >
@@ -45,6 +45,8 @@ import heartBroken from '../../assets/brokenHeart.png';
4545import message from ' ../../assets/message.png' ;
4646import view from ' ../../assets/eye.png' ;
4747import match from ' ../../assets/linkBlack.png' ;
48+ import superlike from ' ../../assets/superlikeNotification.png' ;
49+ import messageLike from ' ../../assets/likeComment.png' ;
4850
4951/* eslint-disable object-curly-newline */
5052/* eslint-disable consistent-return */
@@ -71,6 +73,12 @@ export default {
7173 showNotifications: false ,
7274 }),
7375 methods: {
76+ getRouterLink (link ) {
77+ if (! link) {
78+ return ' /' ;
79+ }
80+ return link;
81+ },
7482 async makeNotificationsSeen () {
7583 const length = this .notifications .length ;
7684 for (let i = 0 ; i < length; i += 1 ) {
@@ -87,17 +95,18 @@ export default {
8795 }
8896 this .showNotifications = ! this .showNotifications ;
8997 },
90- close (event ) {
98+ async close (event ) {
9199 if (! event .currentTarget .contains (event .relatedTarget )) {
92100 this .showNotifications = false ;
93101 this .notify = false ;
102+ await this .makeNotificationsSeen ();
94103 }
95104 },
96105 getImage (type ) {
97106 if (type === ' like' ) {
98107 return heart;
99108 }
100- if (type === ' dislike ' ) {
109+ if (type === ' unlike ' ) {
101110 return heartBroken;
102111 }
103112 if (type === ' match' ) {
@@ -109,6 +118,12 @@ export default {
109118 if (type === ' message' ) {
110119 return message;
111120 }
121+ if (type === ' superlike' ) {
122+ return superlike;
123+ }
124+ if (type === ' message_like' ) {
125+ return messageLike;
126+ }
112127 },
113128 async fetchNotifications () {
114129 const notificationsRequest = await this .$http .get (' /notifications' );
0 commit comments