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

18 lines
470 B
JavaScript

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){
restPost("/notifications/" + id).then( e => fetchNotifications() );
}