timer on notifications
This commit is contained in:
		| @ -2,9 +2,14 @@ import { ref } from 'vue' | |||||||
| import { restGet, restPost } from '@/rest/restConsumer.js' | import { restGet, restPost } from '@/rest/restConsumer.js' | ||||||
|  |  | ||||||
| export const notifications = ref([]); | export const notifications = ref([]); | ||||||
|  | let timerSet = false | ||||||
|  |  | ||||||
| export function fetchNotifications(){ | export function fetchNotifications(){ | ||||||
| 	restGet("/notifications").then( e => notifications.value = e ); | 	restGet("/notifications").then( e => notifications.value = e ); | ||||||
|  | 	if(!timerSet){ | ||||||
|  | 		timerSet = true; | ||||||
|  | 		setTimeout(() => {timerSet = false; fetchNotifications()}, 5000); | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| export function archiveNotification(id){ | export function archiveNotification(id){ | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user