1
0
forked from PGL/Clyde
Files
Clyde/frontend/src/rest/notifications.js

18 lines
470 B
JavaScript
Raw Normal View History

2024-04-17 21:41:29 +02:00
import { ref } from 'vue'
import { restGet, restPost } from '@/rest/restConsumer.js'
export const notifications = ref([]);
2024-04-22 09:09:53 +02:00
let timerSet = false
2024-04-17 21:41:29 +02:00
export function fetchNotifications(){
restGet("/notifications").then( e => notifications.value = e );
2024-04-22 09:09:53 +02:00
if(!timerSet){
timerSet = true;
setTimeout(() => {timerSet = false; fetchNotifications()}, 5000);
}
2024-04-17 21:41:29 +02:00
}
export function archiveNotification(id){
restPost("/notifications/" + id).then( e => fetchNotifications() );
}