Auto-dismiss notifications popover if no unread notifications exist
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user