Browse Source

fix all_notifs link and mark notif as read with switch id

Olivier Massot 2 years ago
parent
commit
499ef3add1
1 changed files with 5 additions and 5 deletions
  1. 5 5
      components/Layout/Header/Notification.vue

+ 5 - 5
components/Layout/Header/Notification.vue

@@ -17,11 +17,12 @@
     </v-badge>
     </v-badge>
   </v-btn>
   </v-btn>
 
 
-  <v-tooltip :activator="btn" location="bottom">
+  <v-tooltip v-if="btn !== null" :activator="btn" location="bottom">
     <span>{{ $t('notification') }}</span>
     <span>{{ $t('notification') }}</span>
   </v-tooltip>
   </v-tooltip>
 
 
   <v-menu
   <v-menu
+      v-if="btn !== null"
       :activator="btn"
       :activator="btn"
       v-model="isOpen"
       v-model="isOpen"
       location="bottom left"
       location="bottom left"
@@ -122,7 +123,6 @@ const query: ComputedRef<AnyJson> = computed(() => {
   return { 'page': page.value }
   return { 'page': page.value }
 })
 })
 
 
-
 let { data: collection, pending, refresh } = await fetchCollection(Notification, null, query)
 let { data: collection, pending, refresh } = await fetchCollection(Notification, null, query)
 
 
 /**
 /**
@@ -143,10 +143,10 @@ const unreadNotification: ComputedRef<Array<Notification>> = computed(() => {
  * Les metadata dépendront de la dernière valeur du GET lancé
  * Les metadata dépendront de la dernière valeur du GET lancé
  */
  */
 const pagination: ComputedRef<Pagination> = computed(() => {
 const pagination: ComputedRef<Pagination> = computed(() => {
-  return collection.value !== null ? collection.value.pagination : {}
+  return (!pending.value && collection.value !== null) ? collection.value.pagination : {}
 })
 })
 
 
-const notificationUrl = UrlUtils.join(runtimeConfig.baseUrlAdminLegacy, 'notifications/list/')
+const notificationUrl = UrlUtils.join(runtimeConfig.baseUrlAdminLegacy, '#/notifications/list/')
 
 
 /**
 /**
  * L'utilisateur a fait défiler le menu jusqu'à la dernière notification affichée
  * L'utilisateur a fait défiler le menu jusqu'à la dernière notification affichée
@@ -224,7 +224,7 @@ const markNotificationAsRead = (notification: Notification) => {
     throw new Error('Current access id is null')
     throw new Error('Current access id is null')
   }
   }
   const notificationUsers = em.newInstance(NotificationUsers, {
   const notificationUsers = em.newInstance(NotificationUsers, {
-    access:`/api/accesses/${accessProfileStore.id}`,
+    access:`/api/accesses/${accessProfileStore.switchId ?? accessProfileStore.id}`,
     notification:`/api/notifications/${notification.id}`,
     notification:`/api/notifications/${notification.id}`,
     isRead: true
     isRead: true
   })
   })