Loading notifications async.
This commit is contained in:
@@ -52,7 +52,7 @@ import {
|
||||
updateNotificationsApi,
|
||||
} from './alerts.js';
|
||||
|
||||
import { fetchNotifications } from '../alerts.js';
|
||||
import { fetchUnseenNotificationsCount } from '../alerts.js';
|
||||
|
||||
import initLogger from '../logger.js';
|
||||
|
||||
@@ -168,7 +168,7 @@ export default async function initServer() {
|
||||
router.get('/api/tags', fetchTagsApi);
|
||||
|
||||
router.get('*', async (req, res, next) => {
|
||||
const notifications = await fetchNotifications(req.user, { limit: 20 });
|
||||
const unseenNotifications = await fetchUnseenNotificationsCount(req.user);
|
||||
|
||||
const pageContextInit = {
|
||||
urlOriginal: req.originalUrl,
|
||||
@@ -191,7 +191,9 @@ export default async function initServer() {
|
||||
maxAggregateSize: config.database.manticore.maxAggregateSize,
|
||||
media: config.media,
|
||||
},
|
||||
notifications,
|
||||
meta: {
|
||||
unseenNotifications,
|
||||
},
|
||||
};
|
||||
|
||||
const pageContext = await renderPage(pageContextInit);
|
||||
|
||||
Reference in New Issue
Block a user