Added notification clear, improved notification styling.

This commit is contained in:
DebaucheryLibrarian
2021-04-25 03:08:50 +02:00
parent f8a3bf6a64
commit fc1c2fc2f3
8 changed files with 265 additions and 77 deletions

View File

@@ -1,6 +1,6 @@
'use strict';
const { addAlert, removeAlert } = require('../alerts');
const { addAlert, removeAlert, updateNotifications, updateNotification } = require('../alerts');
async function addAlertApi(req, res) {
const alertId = await addAlert(req.body, req.session.user);
@@ -14,7 +14,21 @@ async function removeAlertApi(req, res) {
res.status(204).send();
}
async function updateNotificationsApi(req, res) {
await updateNotifications(req.body, req.session.user);
res.status(204).send();
}
async function updateNotificationApi(req, res) {
await updateNotification(req.params.notificationId, req.body, req.session.user);
res.status(204).send();
}
module.exports = {
addAlert: addAlertApi,
removeAlert: removeAlertApi,
updateNotifications: updateNotificationsApi,
updateNotification: updateNotificationApi,
};

View File

@@ -58,6 +58,8 @@ const {
const {
addAlert,
removeAlert,
updateNotifications,
updateNotification,
} = require('./alerts');
async function initServer() {
@@ -91,6 +93,9 @@ async function initServer() {
router.post('/api/users', signup);
router.patch('/api/users/:userId/notifications', updateNotifications);
router.patch('/api/users/:userId/notifications/:notificationId', updateNotification);
router.post('/api/stashes', createStash);
router.patch('/api/stashes/:stashId', updateStash);
router.delete('/api/stashes/:stashId', removeStash);