From 060526c20d572f149ae86d29e6d55fddddf56f7b Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Mon, 22 Apr 2024 09:09:53 +0200 Subject: [PATCH] timer on notifications --- frontend/src/rest/notifications.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/src/rest/notifications.js b/frontend/src/rest/notifications.js index 31d0319..e3919db 100644 --- a/frontend/src/rest/notifications.js +++ b/frontend/src/rest/notifications.js @@ -2,9 +2,14 @@ import { ref } from 'vue' import { restGet, restPost } from '@/rest/restConsumer.js' export const notifications = ref([]); +let timerSet = false export function fetchNotifications(){ restGet("/notifications").then( e => notifications.value = e ); + if(!timerSet){ + timerSet = true; + setTimeout(() => {timerSet = false; fetchNotifications()}, 5000); + } } export function archiveNotification(id){