Auto-dismiss notifications popover if no unread notifications exist

This commit is contained in:
Johannes Zellner
2025-11-03 15:32:01 +01:00
parent bd4e132709
commit b2c8f87276
4 changed files with 66 additions and 61 deletions

View File

@@ -33,6 +33,9 @@ const notificationsAllBusy = ref(false);
function onOpenNotifications(popover, event, elem) {
popover.open(event, elem);
// close after 2 seconds if there is nothing to show
if (notifications.value.length === 0) setTimeout(popover.close, 2000);
}
async function onMarkNotificationRead(notification) {
@@ -55,6 +58,8 @@ async function onMarkAllNotificationRead() {
await refresh();
notificationsAllBusy.value = false;
if (notifications.value.length === 0) setTimeout(helpPopover.value.close, 2000);
}
async function refresh() {

View File

@@ -9,7 +9,7 @@ function create() {
async list(acknowledged = false) {
let result;
try {
result = await fetcher.get(`${API_ORIGIN}/api/v1/notifications`, { acknowledged, access_token: accessToken });
result = await fetcher.get(`${API_ORIGIN}/api/v1/notifications`, { acknowledged, access_token: accessToken, per_page: 100 });
} catch (e) {
return [e];
}