forked from DebaucheryLibrarian/traxxx
Added notification clear, improved notification styling.
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user